[][src]Struct tide::Redirect

pub struct Redirect<T: AsRef<str>> { /* fields omitted */ }

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
    State: Clone + Send + Sync + 'static,
    T: AsRef<str> + Send + Sync + 'static, 
[src]

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
[src]

impl<T> Send for Redirect<T> where
    T: Send
[src]

impl<T> Sync for Redirect<T> where
    T: Sync
[src]

impl<T> Unpin for Redirect<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for Redirect<T> where
    T: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,