pub struct Router<S = ()> { /* private fields */ }Expand description
自定义路由类型
Implementations§
Source§impl<S> Router<S>
impl<S> Router<S>
Sourcepub fn add_route<H, T>(&mut self, method: Method, path: &str, handler: H)where
H: Fn(T) -> Response<Body> + Clone + Send + Sync + 'static,
T: FromRequestParts<S, Error = ExtractorError> + 'static,
pub fn add_route<H, T>(&mut self, method: Method, path: &str, handler: H)where
H: Fn(T) -> Response<Body> + Clone + Send + Sync + 'static,
T: FromRequestParts<S, Error = ExtractorError> + 'static,
添加路由
Sourcepub fn nest_service<T>(self, prefix: &str, service: T) -> Self
pub fn nest_service<T>(self, prefix: &str, service: T) -> Self
嵌套服务
Trait Implementations§
Source§impl<S> From<Router<S>> for RouterBuilder<S>
impl<S> From<Router<S>> for RouterBuilder<S>
Source§impl<S> From<Router<S>> for RouterService<S>
impl<S> From<Router<S>> for RouterService<S>
Auto Trait Implementations§
impl<S> Freeze for Router<S>where
S: Freeze,
impl<S = ()> !RefUnwindSafe for Router<S>
impl<S> Send for Router<S>where
S: Send,
impl<S> Sync for Router<S>where
S: Sync,
impl<S> Unpin for Router<S>where
S: Unpin,
impl<S> UnsafeUnpin for Router<S>where
S: UnsafeUnpin,
impl<S = ()> !UnwindSafe for Router<S>
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