pub struct Redirect { /* private fields */ }
Expand description
Response that redirects the request to another location.
Implementations§
source§impl Redirect
impl Redirect
sourcepub fn other(uri: impl TryInto<Uri>) -> Redirect
pub fn other(uri: impl TryInto<Uri>) -> Redirect
Create a new Redirect
that uses a 303 See Other
status code.
This redirect instructs the client to change the method to GET for the subsequent request
to the given uri
, which is useful after successful form submission, file upload or when
you generally don’t want the redirected-to page to observe the original request method and
body (if non-empty).
Panics
If uri
isn’t a valid Uri
.
sourcepub fn temporary(uri: impl TryInto<Uri>) -> Redirect
pub fn temporary(uri: impl TryInto<Uri>) -> Redirect
Create a new Redirect
that uses a 307 Temporary Redirect
status code.
Panics
If uri
isn’t a valid Uri
.
sourcepub fn permanent(uri: impl TryInto<Uri>) -> Redirect
pub fn permanent(uri: impl TryInto<Uri>) -> Redirect
Create a new Redirect
that uses a 308 Permanent Redirect
status code.
Panics
If uri
isn’t a valid Uri
.
sourcepub fn found(uri: impl TryInto<Uri>) -> Redirect
pub fn found(uri: impl TryInto<Uri>) -> Redirect
Create a new Redirect
that uses a 302 Found
status code.
This is the same as Redirect::temporary
, except the status code is older and thus
supported by some legacy applications that doesn’t understand the newer one, but some of
those applications wrongly apply Redirect::other
(303 See Other
) semantics for this
status code. It should be avoided where possible.
Panics
If uri
isn’t a valid Uri
.
sourcepub fn with_status_code(
status_code: StatusCode,
uri: impl TryInto<Uri>
) -> Result<Redirect, Error>
pub fn with_status_code(
status_code: StatusCode,
uri: impl TryInto<Uri>
) -> Result<Redirect, Error>
Create a new Redirect
that uses a status code.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Redirect
impl Send for Redirect
impl Sync for Redirect
impl Unpin for Redirect
impl UnwindSafe for Redirect
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§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> 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>
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<Key, T> QuotaGetter<Key> for Twhere
Key: 'static + Hash + Eq + Send + Sync,
T: 'static + Clone + Send + Sync,
impl<Key, T> QuotaGetter<Key> for Twhere
Key: 'static + Hash + Eq + Send + Sync,
T: 'static + Clone + Send + Sync,
§type Error = Infallible
type Error = Infallible
source§fn get<'life0, 'life1, 'async_trait, Q>(
&'life0 self,
_key: &'life1 Q
) -> Pin<Box<dyn Future<Output = Result<<T as QuotaGetter<Key>>::Quota, <T as QuotaGetter<Key>>::Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
Key: Borrow<Q>,
Q: Hash + Eq + Sync + 'async_trait,
T: 'async_trait,
fn get<'life0, 'life1, 'async_trait, Q>(
&'life0 self,
_key: &'life1 Q
) -> Pin<Box<dyn Future<Output = Result<<T as QuotaGetter<Key>>::Quota, <T as QuotaGetter<Key>>::Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
Key: Borrow<Q>,
Q: Hash + Eq + Sync + 'async_trait,
T: 'async_trait,
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
source§impl<P> Writer for Pwhere
P: Piece + Send,
impl<P> Writer for Pwhere
P: Piece + Send,
source§fn write<'life0, 'life1, 'life2, 'async_trait>(
self,
_req: &'life0 mut Request,
_depot: &'life1 mut Depot,
res: &'life2 mut Response
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
P: 'async_trait,
fn write<'life0, 'life1, 'life2, 'async_trait>(
self,
_req: &'life0 mut Request,
_depot: &'life1 mut Depot,
res: &'life2 mut Response
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
P: 'async_trait,
Response
.