Struct nucleus_http::routes::Router
source · pub struct Router<S> { /* private fields */ }Implementations§
source§impl<S> Router<S>where
S: Clone + Send + Sync + 'static,
impl<S> Router<S>where S: Clone + Send + Sync + 'static,
pub fn new(state: S) -> Self
pub async fn add_route(&mut self, route: Route<S>)
pub fn routes(&self) -> Routes<S>
sourcepub fn add_default_header(&mut self, header: Header)
pub fn add_default_header(&mut self, header: Header)
Add header to all responses
sourcepub fn add_mime_header(&mut self, header: Header, mime: MimeType)
pub fn add_mime_header(&mut self, header: Header, mime: MimeType)
Add a header that will be added to every response of this mime type
pub fn new_routes() -> Routes<S>
pub async fn route( &self, request: &Request, doc_root: impl AsRef<Path> ) -> Response
Trait Implementations§
Auto Trait Implementations§
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> !UnwindSafe for Router<S>
Blanket Implementations§
§impl<'a, T> AsTaggedExplicit<'a> for Twhere
T: 'a,
impl<'a, T> AsTaggedExplicit<'a> for Twhere T: 'a,
§impl<'a, T> AsTaggedImplicit<'a> for Twhere
T: 'a,
impl<'a, T> AsTaggedImplicit<'a> for Twhere T: 'a,
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