Skip to main content

Router

Struct Router 

Source
pub struct Router<S = ()> { /* private fields */ }
Expand description

Wrapper around axum’s Router, allowing registration of endpoints.

Implementations§

Source§

impl<S> Router<S>
where S: Clone + Send + Sync + 'static,

Source

pub fn endpoint<E: Endpoint<S, V>, V: 'static>(self, endpoint: E) -> Self

Source

pub fn nest<'r>(&'r mut self, base: &'r str) -> NestedRouter<'r, S>

Source

pub fn with_state(self, state: S) -> Router

Source

pub fn modify_axum(&mut self, modifier: impl FnOnce(Router<S>) -> Router<S>)

Source

pub fn registry_mut(&mut self) -> &mut Registry

Source

pub fn modify_openapi( &mut self, modifier: impl FnOnce(&mut Registry, &S) + Send + Sync + 'static, )

Source

pub fn serve_docs(self, path: &str) -> Self

Source§

impl Router

Source

pub fn into_parts(self) -> (Router, OpenApi)

Source

pub fn serve<L>(self, listener: L) -> Serve<L, Router, Router>
where L: Listener,

Trait Implementations§

Source§

impl<S: Clone + Send + Sync + 'static> Default for Router<S>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<S> Freeze for Router<S>

§

impl<S = ()> !RefUnwindSafe for Router<S>

§

impl<S> Send for Router<S>

§

impl<S> Sync for Router<S>

§

impl<S> Unpin for Router<S>

§

impl<S> UnsafeUnpin for Router<S>

§

impl<S = ()> !UnwindSafe for Router<S>

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<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.
Source§

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