Skip to main content

Module response

Module response 

Source
Available on crate feature response only.
Expand description

Provide useful response types.

With the i18n feature, response messages are translated automatically through the request locale; with the response-json feature, JsonResponse serializes the body as {"code": ..., "message": ..., "data": ...}. To define response codes in YAML files and generate the corresponding enums, see response_build.

Structs§

Response
Uniform response type with business code/message/data and i18n support.
ResponseError
Error type for handlers returning RspResult.

Traits§

ResponseCodeTrait
Business code and message carried by a Response.

Type Aliases§

JsonResponseresponse-json
ResponseBuilderFn
RspResult
Alias for a Result with ResponseError as its error type.