pub struct Route {
pub path: String,
pub handler: HashMap<Method, Arc<dyn Handler>>,
pub children: Vec<Route>,
pub middlewares: Vec<Arc<dyn MiddleWareHandler>>,
/* private fields */
}Fields§
§path: String§handler: HashMap<Method, Arc<dyn Handler>>§children: Vec<Route>§middlewares: Vec<Arc<dyn MiddleWareHandler>>Implementations§
Source§impl Route
impl Route
pub fn get<H, Args>(self, handler: H) -> Selfwhere
H: IntoRouteHandler<Args>,
pub fn post<H, Args>(self, handler: H) -> Selfwhere
H: IntoRouteHandler<Args>,
pub fn put<H, Args>(self, handler: H) -> Selfwhere
H: IntoRouteHandler<Args>,
pub fn delete<H, Args>(self, handler: H) -> Selfwhere
H: IntoRouteHandler<Args>,
pub fn patch<H, Args>(self, handler: H) -> Selfwhere
H: IntoRouteHandler<Args>,
pub fn options<H, Args>(self, handler: H) -> Selfwhere
H: IntoRouteHandler<Args>,
Source§impl Route
impl Route
pub fn get_ex<Args, F, Fut, T>(self, f: F) -> Self
pub fn post_ex<Args, F, Fut, T>(self, f: F) -> Self
pub fn put_ex<Args, F, Fut, T>(self, f: F) -> Self
pub fn delete_ex<Args, F, Fut, T>(self, f: F) -> Self
pub fn patch_ex<Args, F, Fut, T>(self, f: F) -> Self
pub fn options_ex<Args, F, Fut, T>(self, f: F) -> Self
Source§impl Route
impl Route
pub fn into_route_tree(self) -> RouteTree
Source§impl Route
impl Route
pub fn new(path: &str) -> Self
pub fn append<R: RouterAdapt>(self, route: R) -> Self
pub fn extend<R: RouterAdapt>(&mut self, routes: Vec<R>)
pub fn hook(self, handler: impl MiddleWareHandler + 'static) -> Self
pub fn push<R: RouterAdapt>(&mut self, route: R)
pub fn hook_first(&mut self, handler: impl MiddleWareHandler + 'static)
Sourcepub fn set_configs(&mut self, configs: Option<Configs>)
pub fn set_configs(&mut self, configs: Option<Configs>)
设置配置(任何路由都可以使用)
Trait Implementations§
Source§impl ConnectionService for Route
impl ConnectionService for Route
Source§fn call(&self, stream: BoxedConnection, peer: SocketAddr) -> ConnectionFuture
fn call(&self, stream: BoxedConnection, peer: SocketAddr) -> ConnectionFuture
处理单个网络连接。 Read more
Source§impl From<Route> for RouteConnectionService
从 Route 自动转换为 RouteConnectionService
impl From<Route> for RouteConnectionService
从 Route 自动转换为 RouteConnectionService
这个实现提供内部转换能力,但通常不需要显式使用, 因为 Route 直接实现了 ConnectionService 并委托给此适配器。
Source§impl<F, T, Fut> HandlerAppend<F, T, Fut> for Route
impl<F, T, Fut> HandlerAppend<F, T, Fut> for Route
fn get(self, handler: F) -> Self
fn post(self, handler: F) -> Self
fn put(self, handler: F) -> Self
fn delete(self, handler: F) -> Self
fn patch(self, handler: F) -> Self
fn options(self, handler: F) -> Self
fn handler_append(&mut self, method: Method, handler: F)
Source§impl HandlerGetter for Route
impl HandlerGetter for Route
Source§impl RouterAdapt for Route
impl RouterAdapt for Route
fn into_router(self) -> Route
Auto Trait Implementations§
impl Freeze for Route
impl !RefUnwindSafe for Route
impl Send for Route
impl Sync for Route
impl Unpin for Route
impl !UnwindSafe for Route
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