Enum leptos_router::TrailingSlash
source · pub enum TrailingSlash {
Drop,
Exact,
Redirect,
}
Expand description
Declares how you would like to handle trailing slashes in Route paths. This
can be set on Router
and overridden in crate::components::Route
Variants§
Drop
This is the default behavior as of Leptos 0.5. Trailing slashes in your
Route
path are stripped. i.e.: the following two route declarations
are equivalent:
<Route path="/foo">
<Route path="/foo/">
Exact
This mode will respect your path as it is written. Ex:
- If you specify
<Route path="/foo">
, then/foo
matches, but/foo/
does not. - If you specify
<Route path="/foo/">
, then/foo/
matches, but/foo
does not.
Redirect
Like Exact
, this mode respects your path as-written. But it will also
add redirects to the specified path if a user nagivates to a URL that is
off by only the trailing slash.
Given <Route path="/foo">
- Visiting
/foo
is valid. - Visiting
/foo/
serves a redirect to/foo
Given <Route path="/foo/">
- Visiting
/foo
serves a redirect to/foo/
- Visiting
/foo/
is valid.
Trait Implementations§
source§impl Clone for TrailingSlash
impl Clone for TrailingSlash
source§fn clone(&self) -> TrailingSlash
fn clone(&self) -> TrailingSlash
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for TrailingSlash
impl Debug for TrailingSlash
source§impl Default for TrailingSlash
impl Default for TrailingSlash
source§fn default() -> TrailingSlash
fn default() -> TrailingSlash
Returns the “default value” for a type. Read more
source§impl PartialEq for TrailingSlash
impl PartialEq for TrailingSlash
impl Eq for TrailingSlash
impl StructuralPartialEq for TrailingSlash
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<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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more