data Response
What a middleware returns: the outcome of the rest of the chain (next(ctx)) or an answer of its own. A response is either
the pass-through of the handler's result (the typed value stays with the handler: a middleware cannot rewrite it) or a
NetError (Response.refuse(e), short-circuit).
Example:
attr Guarded {}
impl Middleware for Guarded {
fn around(ctx: &var Ctx, next: Next) -> Response net, io, time, db {
if !ctx.caller.isUser(none) { return Response.refuse(AccessDenied{}) }
next(ctx)
}
}pub(api) data ResponseС версии. 1.0.0-beta
Поля
pub(api) error: NetError? = none | The error the call ends with; |
pub(api) passed: bool = false |
|
Методы
refuse | (e: NetError) -> ResponseA short-circuit answer |
failed | () -> booltrue when the call ended with a NetError (a refusal, or an error of the handler itself, that next reported). |
Определено в: std/core/rpc.oxl:442