pub struct MethodRouter { /* private fields */ }Expand description
Per-path method table: get(list).post(create) (spec §4.1).
Implementations§
Source§impl MethodRouter
impl MethodRouter
pub fn on<H: Handler<A>, A>(self, method: Method, h: H) -> Self
Sourcepub fn body_limit(self, bytes: usize) -> Self
pub fn body_limit(self, bytes: usize) -> Self
Cap the request body for THIS route at bytes, overriding the app’s
1 MiB default (spec §4.4). The cap is per-route — it applies to every
method registered here, not per-method. Bodies over the cap are
rejected with 413 before the handler runs.
Sourcepub fn stream_body(self) -> Self
pub fn stream_body(self) -> Self
Marks every method on this route as STREAMING: the body is not buffered
before dispatch; extractors read it incrementally (Multipart) or drain it
on demand (Json/RawBody). body_limit still caps cumulative bytes.
Sourcepub fn handler_timeout(self, budget: Duration) -> Self
pub fn handler_timeout(self, budget: Duration) -> Self
Override the app-global handler-time budget for THIS route (issue #111).
A slow-but-moving upload on a .stream_body() route drains inside the
handler, so raise this (not the app-global in tool-owned main.rs — that
trips JL0003) to give the drain room. None ⇒ the app default applies.
Sourcepub fn body_read_timeout(self, budget: Duration) -> Self
pub fn body_read_timeout(self, budget: Duration) -> Self
Override the app-global per-frame body-read deadline for THIS route (#111).