[][src]Enum saphir::http_context::State

pub enum State {
    Before(Box<Request>),
    After(Box<Response>),
    Empty,
}

State of the Http context. It represent whether the context is used Before(..) or After(..) calling the handler responsible of generating a responder. Empty will be the state of a context when the request is being processed by the handler, or when its original state has been moved by using take & take unchecked methods

Variants

Before(Box<Request>)
After(Box<Response>)
Empty

Implementations

impl State[src]

pub fn take(&mut self) -> Self[src]

Take the current context leaving State::Empty behind

pub fn take_request(&mut self) -> Option<Request>[src]

Take the current request leaving State::Empty behind Returns Some(Request) if the state was Before or None if it was something else

pub fn take_request_unchecked(&mut self) -> Request[src]

Take the current request leaving State::Empty behind

Panics

Panics if the state is not Before

pub fn take_response(&mut self) -> Option<Response>[src]

Take the current response leaving State::Empty behind Returns Some(Response) if the state was After or None if it was something else

pub fn take_response_unchecked(&mut self) -> Response[src]

Take the current response leaving State::Empty behind

Panics

Panics if the state is not After

pub fn request(&self) -> Option<&Request>[src]

Returns Some of the current request if state if Before

pub fn request_mut(&mut self) -> Option<&Request>[src]

Returns Some of the current request as a mutable ref if state if Before

pub fn request_unchecked(&self) -> &Request[src]

Returns the current request

Panics

Panics if state is not Before

pub fn request_unchecked_mut(&mut self) -> &mut Request[src]

Returns the current request as a mutable ref

Panics

panics if state is not Before

pub fn response(&self) -> Option<&Response>[src]

Returns Some of the current response if state if After

pub fn response_mut(&mut self) -> Option<&mut Response>[src]

Returns Some of the current response as a mutable ref if state if After

pub fn response_unchecked(&self) -> &Response[src]

Returns the current response

Panics

Panics if state is not After

pub fn response_unchecked_mut(&mut self) -> &mut Response[src]

Returns the current response as a mutable ref

Panics

Panics if state is not After

Trait Implementations

impl Default for State[src]

Auto Trait Implementations

impl !RefUnwindSafe for State

impl Send for State

impl Sync for State

impl Unpin for State

impl !UnwindSafe for State

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, 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.