Struct salvo::prelude::trailing_slash::TrailingSlash
source · pub struct TrailingSlash {
pub action: TrailingSlashAction,
pub skipper: Box<dyn Skipper + 'static, Global>,
pub redirect_code: StatusCode,
}
Available on crate feature
trailing-slash
only.Expand description
TrailingSlash
Fields§
§action: TrailingSlashAction
Action of this TrailingSlash
.
skipper: Box<dyn Skipper + 'static, Global>
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 with_skipper(self, skipper: impl Skipper) -> TrailingSlash
pub fn with_skipper(self, skipper: impl Skipper) -> TrailingSlash
Sets skipper and returns new TrailingSlash
.
sourcepub fn with_redirect_code(self, redirect_code: StatusCode) -> TrailingSlash
pub fn with_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, Global>>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, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
TrailingSlash: 'async_trait,
Handle http request.