Enum saphir::http_context::State
source · pub enum State {
Before(Box<Request>),
After(Box<Response>),
Empty,
}
Expand description
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§
Implementations§
source§impl State
impl State
sourcepub fn take_request(&mut self) -> Option<Request>
pub fn take_request(&mut self) -> Option<Request>
Take the current request leaving State::Empty
behind
Returns Some(Request)
if the state was Before
or None
if it was
something else
sourcepub fn take_request_unchecked(&mut self) -> Request
pub fn take_request_unchecked(&mut self) -> Request
sourcepub fn take_response(&mut self) -> Option<Response>
pub fn take_response(&mut self) -> Option<Response>
Take the current response leaving State::Empty
behind
Returns Some(Response)
if the state was After
or None
if it was
something else
sourcepub fn take_response_unchecked(&mut self) -> Response
pub fn take_response_unchecked(&mut self) -> Response
sourcepub fn request(&self) -> Option<&Request>
pub fn request(&self) -> Option<&Request>
Returns Some
of the current request if state if Before
sourcepub fn request_mut(&mut self) -> Option<&Request>
pub fn request_mut(&mut self) -> Option<&Request>
Returns Some
of the current request as a mutable ref if state if
Before
sourcepub fn request_unchecked(&self) -> &Request
pub fn request_unchecked(&self) -> &Request
sourcepub fn request_unchecked_mut(&mut self) -> &mut Request
pub fn request_unchecked_mut(&mut self) -> &mut Request
sourcepub fn response(&self) -> Option<&Response>
pub fn response(&self) -> Option<&Response>
Returns Some
of the current response if state if After
sourcepub fn response_mut(&mut self) -> Option<&mut Response>
pub fn response_mut(&mut self) -> Option<&mut Response>
Returns Some
of the current response as a mutable ref if state if
After