pub struct Redirect<T: AsRef<str>> { /* private fields */ }
Expand description
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§
Source§impl<T: AsRef<str>> Redirect<T>
impl<T: AsRef<str>> Redirect<T>
Sourcepub fn new(location: T) -> Self
pub fn new(location: T) -> Self
Creates an endpoint that represents a redirect to location
.
Uses status code 302 Found.
Sourcepub fn permanent(location: T) -> Self
pub fn permanent(location: T) -> Self
Creates an endpoint that represents a permanent redirect to location
.
Uses status code 301 Permanent Redirect.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Redirect<T>where
T: Freeze,
impl<T> RefUnwindSafe for Redirect<T>where
T: RefUnwindSafe,
impl<T> Send for Redirect<T>where
T: Send,
impl<T> Sync for Redirect<T>where
T: Sync,
impl<T> Unpin for Redirect<T>where
T: Unpin,
impl<T> UnwindSafe for Redirect<T>where
T: 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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)