pub struct RouterBuilder<S = ()> { /* private fields */ }Expand description
路由构建器
Implementations§
Source§impl<S> RouterBuilder<S>
impl<S> RouterBuilder<S>
Sourcepub fn from_router(router: Router<S>) -> Self
pub fn from_router(router: Router<S>) -> Self
从现有路由创建构建器
Sourcepub fn get<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Fn(T) -> Response<Body> + Clone + Send + Sync + 'static,
T: FromRequestParts<S, Error = ExtractorError> + 'static,
pub fn get<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Fn(T) -> Response<Body> + Clone + Send + Sync + 'static,
T: FromRequestParts<S, Error = ExtractorError> + 'static,
添加 GET 方法路由
Sourcepub fn post<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Fn(T) -> Response<Body> + Clone + Send + Sync + 'static,
T: FromRequestParts<S, Error = ExtractorError> + 'static,
pub fn post<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Fn(T) -> Response<Body> + Clone + Send + Sync + 'static,
T: FromRequestParts<S, Error = ExtractorError> + 'static,
添加 POST 方法路由
Sourcepub fn put<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Fn(T) -> Response<Body> + Clone + Send + Sync + 'static,
T: FromRequestParts<S, Error = ExtractorError> + 'static,
pub fn put<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Fn(T) -> Response<Body> + Clone + Send + Sync + 'static,
T: FromRequestParts<S, Error = ExtractorError> + 'static,
添加 PUT 方法路由
Sourcepub fn delete<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Fn(T) -> Response<Body> + Clone + Send + Sync + 'static,
T: FromRequestParts<S, Error = ExtractorError> + 'static,
pub fn delete<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Fn(T) -> Response<Body> + Clone + Send + Sync + 'static,
T: FromRequestParts<S, Error = ExtractorError> + 'static,
添加 DELETE 方法路由
Sourcepub fn patch<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Fn(T) -> Response<Body> + Clone + Send + Sync + 'static,
T: FromRequestParts<S, Error = ExtractorError> + 'static,
pub fn patch<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Fn(T) -> Response<Body> + Clone + Send + Sync + 'static,
T: FromRequestParts<S, Error = ExtractorError> + 'static,
添加 PATCH 方法路由
Sourcepub fn options<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Fn(T) -> Response<Body> + Clone + Send + Sync + 'static,
T: FromRequestParts<S, Error = ExtractorError> + 'static,
pub fn options<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Fn(T) -> Response<Body> + Clone + Send + Sync + 'static,
T: FromRequestParts<S, Error = ExtractorError> + 'static,
添加 OPTIONS 方法路由
Sourcepub fn head<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Fn(T) -> Response<Body> + Clone + Send + Sync + 'static,
T: FromRequestParts<S, Error = ExtractorError> + 'static,
pub fn head<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Fn(T) -> Response<Body> + Clone + Send + Sync + 'static,
T: FromRequestParts<S, Error = ExtractorError> + 'static,
添加 HEAD 方法路由
Sourcepub fn trace<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Fn(T) -> Response<Body> + Clone + Send + Sync + 'static,
T: FromRequestParts<S, Error = ExtractorError> + 'static,
pub fn trace<H, T>(self, path: &str, handler: H) -> Selfwhere
H: Fn(T) -> Response<Body> + Clone + Send + Sync + 'static,
T: FromRequestParts<S, Error = ExtractorError> + 'static,
添加 TRACE 方法路由
Sourcepub fn into_inner(self) -> Router<S>
pub fn into_inner(self) -> Router<S>
获取内部 Router 实例
Trait Implementations§
Source§impl<S> Default for RouterBuilder<S>
impl<S> Default for RouterBuilder<S>
Source§impl<S> From<Router<S>> for RouterBuilder<S>
impl<S> From<Router<S>> for RouterBuilder<S>
Auto Trait Implementations§
impl<S> Freeze for RouterBuilder<S>where
S: Freeze,
impl<S = ()> !RefUnwindSafe for RouterBuilder<S>
impl<S> Send for RouterBuilder<S>where
S: Send,
impl<S> Sync for RouterBuilder<S>where
S: Sync,
impl<S> Unpin for RouterBuilder<S>where
S: Unpin,
impl<S> UnsafeUnpin for RouterBuilder<S>where
S: UnsafeUnpin,
impl<S = ()> !UnwindSafe for RouterBuilder<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