OxL Справочник OxL
РусскийEnglish

method Middleware.around

Wraps every call of the rpc the attribute is written on: runs code before and after next(ctx), or refuses the call with Response.refuse(e) without calling next.

Example:

oxl✓ проверяется в CI
attr Timed {}

impl Middleware for Timed {
  fn around(ctx: &var Ctx, next: Next) -> Response net, io, time, db {
    let t0 = Instant.now()
    let r = next(ctx)
    print("took {t0.elapsed().millis()} ms")
    r
  }
}
fn around(ctx: &var Ctx, next: Next) -> Response  net, io, time, db

С версии. 1.0.0-beta

Параметры

ИмяТип
ctx&var Ctx
nextNext

Возвращает

Response

Эффекты

net, io, time, db

Определено в: std/core/rpc.oxl:542

См. также