[][src]Struct oxide_auth::frontends::simple::request::MapErr

pub struct MapErr<W, F, T>(_, _, _);

Changes the error type of a web request and response.

Methods

impl<W, F, T> MapErr<W, F, T>[src]

pub fn request(request: W, f: F) -> Self where
    W: WebRequest,
    F: FnMut(W::Error) -> T, 
[src]

Map all errors in request methods using the given function.

pub fn response(response: W, f: F) -> Self where
    W: WebResponse,
    F: FnMut(W::Error) -> T, 
[src]

Map all errors in response methods using the given function.

pub fn into_inner(self) -> W[src]

Recover original response or request.

Trait Implementations

impl<W: WebRequest, F, T> WebRequest for MapErr<W, F, T> where
    F: FnMut(W::Error) -> T, 
[src]

type Error = T

The error generated from access of malformed or invalid requests.

type Response = MapErr<W::Response, F, T>

The corresponding type of Responses returned from this module.

impl<W: WebResponse, F, T> WebResponse for MapErr<W, F, T> where
    F: FnMut(W::Error) -> T, 
[src]

type Error = T

The error generated when trying to construct an unhandled or invalid response.

fn redirect(&mut self, url: Url) -> Result<(), Self::Error>[src]

A response which will redirect the user-agent to which the response is issued.

fn client_error(&mut self) -> Result<(), Self::Error>[src]

Set the response status to 400.

fn unauthorized(&mut self, header_value: &str) -> Result<(), Self::Error>[src]

Set the response status to 401 and add a WWW-Authenticate header.

fn body_text(&mut self, text: &str) -> Result<(), Self::Error>[src]

A pure text response with no special media type set.

fn body_json(&mut self, data: &str) -> Result<(), Self::Error>[src]

Json repsonse data, with media type `aplication/json.

Auto Trait Implementations

impl<W, F, T> Unpin for MapErr<W, F, T> where
    F: Unpin,
    T: Unpin,
    W: Unpin

impl<W, F, T> Send for MapErr<W, F, T> where
    F: Send,
    T: Send,
    W: Send

impl<W, F, T> Sync for MapErr<W, F, T> where
    F: Sync,
    T: Sync,
    W: Sync

impl<W, F, T> RefUnwindSafe for MapErr<W, F, T> where
    F: RefUnwindSafe,
    T: RefUnwindSafe,
    W: RefUnwindSafe

impl<W, F, T> UnwindSafe for MapErr<W, F, T> where
    F: UnwindSafe,
    T: UnwindSafe,
    W: UnwindSafe

Blanket Implementations

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

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

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<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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

impl<T> Erased for T

impl<T> Typeable for T where
    T: Any

fn get_type(&self) -> TypeId

Get the TypeId of this object.

impl<T> UnsafeAny for T where
    T: Any

impl<T> IntoCollection<T> for T

impl<T, I> AsResult<T, I> for T where
    I: Input,