pub struct Router<S = ()>(_);Expand description
Router for building a web application. Uses Axum router underneath and supports using handlers with axum’s Extractors Run with crate::program::commands::http::ServerCommand
Implementations
sourceimpl<S> Router<S>where
S: Send + Sync + Default + 'static,
impl<S> Router<S>where
S: Send + Sync + Default + 'static,
pub fn new() -> Self
pub fn on<TextLike, H, T1, Res>(
self,
filter: MethodFilter,
path: TextLike,
handler: H
) -> Selfwhere
TextLike: Into<Text>,
Res: IntoResponse,
H: PuffHandler<T1, S, Res>,
pub fn get<TextLike, H, T1, Res>(self, path: TextLike, handler: H) -> Selfwhere
TextLike: Into<Text>,
Res: IntoResponse,
H: PuffHandler<T1, S, Res>,
pub fn post<TextLike, H, T1, Res>(self, path: TextLike, handler: H) -> Selfwhere
TextLike: Into<Text>,
Res: IntoResponse,
H: PuffHandler<T1, S, Res>,
pub fn head<TextLike, H, T1, Res>(self, path: TextLike, handler: H) -> Selfwhere
TextLike: Into<Text>,
Res: IntoResponse,
H: PuffHandler<T1, S, Res>,
pub fn options<TextLike, H, T1, Res>(self, path: TextLike, handler: H) -> Selfwhere
TextLike: Into<Text>,
Res: IntoResponse,
H: PuffHandler<T1, S, Res>,
pub fn put<TextLike, H, T1, Res>(self, path: TextLike, handler: H) -> Selfwhere
TextLike: Into<Text>,
Res: IntoResponse,
H: PuffHandler<T1, S, Res>,
pub fn patch<TextLike, H, T1, Res>(self, path: TextLike, handler: H) -> Selfwhere
TextLike: Into<Text>,
Res: IntoResponse,
H: PuffHandler<T1, S, Res>,
pub fn trace<TextLike, H, T1, Res>(self, path: TextLike, handler: H) -> Selfwhere
TextLike: Into<Text>,
Res: IntoResponse,
H: PuffHandler<T1, S, Res>,
pub fn delete<TextLike, H, T1, Res>(self, path: TextLike, handler: H) -> Selfwhere
TextLike: Into<Text>,
Res: IntoResponse,
H: PuffHandler<T1, S, Res>,
pub fn any<TextLike, H, T1, Res>(self, path: TextLike, handler: H) -> Selfwhere
TextLike: Into<Text>,
Res: IntoResponse,
H: PuffHandler<T1, S, Res>,
pub fn service<TextLike, T>(self, path: TextLike, f: T) -> Selfwhere
TextLike: Into<Text>,
T: Service<AxumRequest<Body>, Error = Infallible> + Clone + Send + 'static,
T::Response: IntoResponse + 'static,
T::Future: Send + 'static,
pub fn layer<L>(self, layer: L) -> Selfwhere
L: Layer<Route>,
L::Service: Service<Request> + Clone + Send + 'static,
<L::Service as Service<Request>>::Response: IntoResponse + 'static,
<L::Service as Service<Request>>::Error: Into<Infallible> + 'static,
<L::Service as Service<Request>>::Future: Send + 'static,
pub fn into_hyper_server(
self,
addr: &SocketAddr,
puff_context: PuffContext
) -> Server<AddrIncoming, IntoMakeService<Router<S>>>
Trait Implementations
Auto Trait Implementations
impl<S = ()> !RefUnwindSafe for Router<S>
impl<S> Send for Router<S>where
S: Send + Sync,
impl<S = ()> !Sync for Router<S>
impl<S> Unpin for Router<S>
impl<S = ()> !UnwindSafe for Router<S>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more