Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

How to implement complex display expression? #268

Description

@jmjoy

For example:

errors {
        #[doc = "Response not complete, first is protocol status and second is app status, see fastcgi protocol."]
        EndRequest(protocol_status: ProtocolStatus, app_status: u32) {
            description("End request error."),
            display(match protocol_status {
                ProtocolStatus::CantMpxConn => "This app can't multiplex [CantMpxConn]; AppStatus: {}",
                ProtocolStatus::Overloaded => "New request rejected; too busy [OVERLOADED]; AppStatus: {}",
                ProtocolStatus::UnknownRole => "Role value not known [UnknownRole]; AppStatus: {}",
                _ => unreachable!(),
            }, app_status),
        }

}

But now, display not support first argument is string literal, so more complex expression of display is not work, is there a choice to support it?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions