Skip to main content

MethodRouter

Struct MethodRouter 

Source
pub struct MethodRouter { /* private fields */ }
Expand description

Per-path method table: get(list).post(create) (spec §4.1).

Implementations§

Source§

impl MethodRouter

Source

pub fn on<H: Handler<A>, A>(self, method: Method, h: H) -> Self

Source

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.

Source

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.

Source

pub fn get<H: Handler<A>, A>(self, h: H) -> Self

Source

pub fn post<H: Handler<A>, A>(self, h: H) -> Self

Source

pub fn put<H: Handler<A>, A>(self, h: H) -> Self

Source

pub fn patch<H: Handler<A>, A>(self, h: H) -> Self

Source

pub fn delete<H: Handler<A>, A>(self, h: H) -> Self

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.