[−][src]Struct tide::Redirect
A redirection endpoint.
Example
async fn route_handler(request: Request<()>) -> tide::Result { if let Some(product_url) = next_product() { Ok(Redirect::new(product_url).into()) } else { //... } }
Implementations
impl<T: AsRef<str>> Redirect<T>
[src]
pub fn new(location: T) -> Self
[src]
Creates an endpoint that represents a redirect to location
.
Uses status code 302 Found.
pub fn permanent(location: T) -> Self
[src]
Creates an endpoint that represents a permanent redirect to location
.
Uses status code 301 Permanent Redirect.
pub fn temporary(location: T) -> Self
[src]
Creates an endpoint that represents a temporary redirect to location
.
Uses status code 307 Temporary Redirect.
pub fn see_other(location: T) -> Self
[src]
Creates an endpoint that represents a see other redirect to location
.
Uses status code 303 See Other.
Trait Implementations
impl<T: Clone + AsRef<str>> Clone for Redirect<T>
[src]
impl<T: Debug + AsRef<str>> Debug for Redirect<T>
[src]
impl<State, T> Endpoint<State> for Redirect<T> where
T: AsRef<str> + Send + Sync + 'static,
[src]
T: AsRef<str> + Send + Sync + 'static,
fn call<'a>(
&'a self,
_req: Request<State>
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'a>>
[src]
&'a self,
_req: Request<State>
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'a>>
impl<T: AsRef<str>> Into<Response> for Redirect<T>
[src]
impl<'_, T: AsRef<str>> Into<Response> for &'_ Redirect<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Redirect<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Redirect<T> where
T: Send,
T: Send,
impl<T> Sync for Redirect<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Redirect<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Redirect<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Sealed<T> for T where
T: ?Sized,
T: ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,