pub struct Router<UserState> {
pub name: String,
pub fullpath: String,
pub methods: HashSet<Method>,
pub action: Option<MethodRouter<State<UserState>>>,
}
Fields§
§name: String
§fullpath: String
§methods: HashSet<Method>
§action: Option<MethodRouter<State<UserState>>>
Implementations§
Source§impl<US> Router<US>
impl<US> Router<US>
pub fn path(path: impl ToString + Debug) -> Self
pub fn any<Action, ActionType>(self, action: Action) -> Self
pub fn delete<Action, ActionType>(self, action: Action) -> Self
pub fn get<Action, ActionType>(self, action: Action) -> Self
pub fn head<Action, ActionType>(self, action: Action) -> Self
pub fn options<Action, ActionType>(self, action: Action) -> Self
pub fn patch<Action, ActionType>(self, action: Action) -> Self
pub fn post<Action, ActionType>(self, action: Action) -> Self
pub fn put<Action, ActionType>(self, action: Action) -> Self
pub fn trace<Action, ActionType>(self, action: Action) -> Self
Source§impl<US> Router<US>
impl<US> Router<US>
pub fn layer<Layer>(self, layer: Layer) -> Selfwhere
US: 'static + Clone + Send + Sync,
Layer: Clone + Send + Sync + 'static + Layer<Route>,
Layer::Service: Service<Request<Body>, Error = Infallible> + Clone + Send + 'static,
<Layer::Service as Service<Request<Body>>>::Response: IntoResponse + 'static,
<Layer::Service as Service<Request<Body>>>::Future: Send + 'static,
pub fn route_layer<Layer>(self, layer: Layer) -> Selfwhere
US: 'static + Clone + Send + Sync,
Layer: Clone + Send + Sync + 'static + Layer<Route>,
Layer::Service: Service<Request<Body>, Error = Infallible> + Clone + Send + 'static,
<Layer::Service as Service<Request<Body>>>::Response: IntoResponse + 'static,
<Layer::Service as Service<Request<Body>>>::Future: Send + 'static,
Auto Trait Implementations§
impl<UserState> Freeze for Router<UserState>
impl<UserState> !RefUnwindSafe for Router<UserState>
impl<UserState> Send for Router<UserState>
impl<UserState> !Sync for Router<UserState>
impl<UserState> Unpin for Router<UserState>
impl<UserState> !UnwindSafe for Router<UserState>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more