pub struct Route<S> { /* private fields */ }Implementations§
Source§impl<S> Route<S>
impl<S> Route<S>
Sourcepub fn redirect_all(redirect_url: &str) -> Self
pub fn redirect_all(redirect_url: &str) -> Self
Reroutes all traffic to url
pub fn get<R>(path: &str, func: R) -> Selfwhere
R: RequestResolver<S>,
pub fn post<R>(path: &str, func: R) -> Selfwhere
R: RequestResolver<S>,
Sourcepub fn embed(path: &str, body: &'static [u8], mime: MimeType) -> Self
pub fn embed(path: &str, body: &'static [u8], mime: MimeType) -> Self
use include_bytes! to load a file as static when this route is requested the static data is return with the passes mime type
Sourcepub fn get_static(path: &str, file_path: &str) -> Self
pub fn get_static(path: &str, file_path: &str) -> Self
Static file map Allows remapping a route to a file {file_path} is a is relative path to static file (without leading /) that will be joined with vhost root dir to serve eg. path = / file_path = index.html will remap all “/” requests to index.html
pub fn method(&self) -> &Method
pub fn resolver(&self) -> &RouteResolver<S>
pub fn path(&self) -> &str
Sourcepub fn matches_request(&self, request: &Request) -> bool
pub fn matches_request(&self, request: &Request) -> bool
FIXME: this should be a little more robust and look for wild cards only if not route is defined. as well as look for redirect all paths first and default to them for now if you want redirect all that should be the only route on the server
Auto Trait Implementations§
impl<S> Freeze for Route<S>
impl<S> !RefUnwindSafe for Route<S>
impl<S> Send for Route<S>
impl<S> Sync for Route<S>
impl<S> Unpin for Route<S>
impl<S> !UnwindSafe for Route<S>
Blanket Implementations§
Source§impl<'a, T> AsTaggedExplicit<'a> for Twhere
T: 'a,
impl<'a, T> AsTaggedExplicit<'a> for Twhere
T: 'a,
Source§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