Struct salvo::prelude::TrailingSlash
source · #[non_exhaustive]pub struct TrailingSlash {
pub action: TrailingSlashAction,
pub skipper: Box<dyn Skipper>,
pub redirect_code: StatusCode,
}
Available on crate feature
trailing-slash
only.Expand description
TrailingSlash
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.action: TrailingSlashAction
Action of this TrailingSlash
.
skipper: Box<dyn Skipper>
Skip to Remove or add slash when skipper is returns true
.
redirect_code: StatusCode
Redirect code is used when redirect url.
Implementations§
source§impl TrailingSlash
impl TrailingSlash
sourcepub fn new(action: TrailingSlashAction) -> TrailingSlash
pub fn new(action: TrailingSlashAction) -> TrailingSlash
Create new TrailingSlash
.
sourcepub fn new_add() -> TrailingSlash
pub fn new_add() -> TrailingSlash
Create new TrailingSlash
and sets it’s action as TrailingSlashAction::Add
.
sourcepub fn new_remove() -> TrailingSlash
pub fn new_remove() -> TrailingSlash
Create new TrailingSlash
and sets it’s action as TrailingSlashAction::Remove
.
sourcepub fn skipper(self, skipper: impl Skipper) -> TrailingSlash
pub fn skipper(self, skipper: impl Skipper) -> TrailingSlash
Sets skipper and returns new TrailingSlash
.
sourcepub fn redirect_code(self, redirect_code: StatusCode) -> TrailingSlash
pub fn redirect_code(self, redirect_code: StatusCode) -> TrailingSlash
Sets redirect code and returns new TrailingSlash
.
Trait Implementations§
source§impl Handler for TrailingSlash
impl Handler for TrailingSlash
source§fn handle<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
req: &'life1 mut Request,
depot: &'life2 mut Depot,
res: &'life3 mut Response,
ctrl: &'life4 mut FlowCtrl
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
TrailingSlash: 'async_trait,
fn handle<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
req: &'life1 mut Request,
depot: &'life2 mut Depot,
res: &'life3 mut Response,
ctrl: &'life4 mut FlowCtrl
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
TrailingSlash: 'async_trait,
Handle http request.
Auto Trait Implementations§
impl Freeze for TrailingSlash
impl !RefUnwindSafe for TrailingSlash
impl Send for TrailingSlash
impl Sync for TrailingSlash
impl Unpin for TrailingSlash
impl !UnwindSafe for TrailingSlash
Blanket Implementations§
source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> 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