Struct leptos_router::RedirectProps
source · pub struct RedirectProps<P>where
P: Display + 'static,{
pub path: P,
pub options: Option<NavigateOptions>,
}
Expand description
Props for the Redirect
component.
Redirects the user to a new URL, whether on the client side or on the server
side. If rendered on the server, this sets a 302
status code and sets a Location
header. If rendered in the browser, it uses client-side navigation to redirect.
In either case, it resolves the route relative to the current route. (To use
an absolute path, prefix it with /
).
Note: Support for server-side redirects is provided by the server framework
integrations (leptos_actix
and leptos_axum
. If you’re not using one of those
integrations, you should manually provide a way of redirecting on the server
using provide_server_redirect
.
§Required Props
- path: [
P
]- The relative path to which the user should be redirected.
§Optional Props
- options:
NavigateOptions
- Navigation options to be used on the client side.
Fields§
§path: P
The relative path to which the user should be redirected.
options: Option<NavigateOptions>
Navigation options to be used on the client side.
Implementations§
source§impl<P> RedirectProps<P>where
P: Display + 'static,
impl<P> RedirectProps<P>where
P: Display + 'static,
Trait Implementations§
Auto Trait Implementations§
impl<P> Freeze for RedirectProps<P>where
P: Freeze,
impl<P> RefUnwindSafe for RedirectProps<P>where
P: RefUnwindSafe,
impl<P> !Send for RedirectProps<P>
impl<P> !Sync for RedirectProps<P>
impl<P> Unpin for RedirectProps<P>where
P: Unpin,
impl<P> UnwindSafe for RedirectProps<P>where
P: UnwindSafe,
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
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>
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>
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