pub struct Router { /* private fields */ }Expand description
Implementations§
Source§impl Router
impl Router
Sourcepub fn route<S>(self, path: &str, service: S) -> Self
pub fn route<S>(self, path: &str, service: S) -> Self
将服务挂载到一条路由上。
§例子
use std::convert::Infallible;
use puzz_core::service_fn;
use puzz_route::Router;
Router::new()
.route("/hi", service_fn(|_| async { Ok::<_, Infallible>("hi!") }));Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Router
impl !RefUnwindSafe for Router
impl !Send for Router
impl !Sync for Router
impl Unpin for Router
impl !UnwindSafe for Router
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