Struct Redirect
struct Redirect { ... }
Response that redirects the request to another location.
Example
use ;
let app = new
.route
.route;
# let _: Router = app;
Implementations
impl Redirect
fn to(uri: &str) -> SelfCreate a new
Redirectthat uses a303 See Otherstatus 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). If you want to preserve the request method and body,Redirect::temporaryshould be used instead.Panics
If
uriisn't a validHeaderValue.fn temporary(uri: &str) -> SelfCreate a new
Redirectthat uses a307 Temporary Redirectstatus code.This has the same behavior as
Redirect::to, except it will preserve the original HTTP method and body.Panics
If
uriisn't a validHeaderValue.fn permanent(uri: &str) -> SelfCreate a new
Redirectthat uses a308 Permanent Redirectstatus code.Panics
If
uriisn't a validHeaderValue.
impl Clone for Redirect
fn clone(self: &Self) -> Redirect
impl Debug for Redirect
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl Freeze for Redirect
impl IntoResponse for Redirect
fn into_response(self: Self) -> Response
impl RefUnwindSafe for Redirect
impl Send for Redirect
impl Sync for Redirect
impl Unpin for Redirect
impl UnsafeUnpin for Redirect
impl UnwindSafe for Redirect
impl<H, T> HandlerWithoutStateExt for Redirect
fn into_service(self: Self) -> HandlerService<H, T, ()>fn into_make_service(self: Self) -> IntoMakeService<HandlerService<H, T, ()>>fn into_make_service_with_connect_info<C>(self: Self) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>
impl<T> Any for Redirect
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Redirect
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Redirect
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Redirect
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for Redirect
fn from(t: T) -> TReturns the argument unchanged.
impl<T> FromRef for Redirect
fn from_ref(input: &T) -> T
impl<T> Instrument for Redirect
impl<T> Same for Redirect
impl<T> ToOwned for Redirect
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T> WithSubscriber for Redirect
impl<T, U> Into for Redirect
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Redirect
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Redirect
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>
impl<V, T> VZip for Redirect
fn vzip(self: Self) -> V