pub struct WebmachineContext {
pub request: WebmachineRequest,
pub response: WebmachineResponse,
pub selected_media_type: Option<String>,
pub selected_language: Option<String>,
pub selected_charset: Option<String>,
pub selected_encoding: Option<String>,
pub if_unmodified_since: Option<DateTime<FixedOffset>>,
pub if_modified_since: Option<DateTime<FixedOffset>>,
pub redirect: bool,
pub new_resource: bool,
pub metadata: HashMap<String, MetaDataValue>,
pub start_time: SystemTime,
}
Expand description
Main context struct that holds the request and response.
Fields§
§request: WebmachineRequest
Request that the webmachine is executing against
response: WebmachineResponse
Response that is the result of the execution
selected_media_type: Option<String>
selected media type after content negotiation
selected_language: Option<String>
selected language after content negotiation
selected_charset: Option<String>
selected charset after content negotiation
selected_encoding: Option<String>
selected encoding after content negotiation
if_unmodified_since: Option<DateTime<FixedOffset>>
parsed date and time from the If-Unmodified-Since header
if_modified_since: Option<DateTime<FixedOffset>>
parsed date and time from the If-Modified-Since header
redirect: bool
If the response should be a redirect
new_resource: bool
If a new resource was created
metadata: HashMap<String, MetaDataValue>
General store of metadata. You can use this to store attributes as the webmachine executes.
start_time: SystemTime
Start time instant when the context was created
Implementations§
Source§impl WebmachineContext
impl WebmachineContext
Sourcepub fn downcast_metadata_value<'a, T: 'static>(
&'a self,
key: &'a str,
) -> Option<&'a T>
pub fn downcast_metadata_value<'a, T: 'static>( &'a self, key: &'a str, ) -> Option<&'a T>
Convenience method to downcast a metadata anything value
Trait Implementations§
Source§impl Clone for WebmachineContext
impl Clone for WebmachineContext
Source§fn clone(&self) -> WebmachineContext
fn clone(&self) -> WebmachineContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for WebmachineContext
impl Debug for WebmachineContext
Source§impl Default for WebmachineContext
impl Default for WebmachineContext
Source§fn default() -> WebmachineContext
fn default() -> WebmachineContext
Creates a default context
Auto Trait Implementations§
impl !Freeze for WebmachineContext
impl !RefUnwindSafe for WebmachineContext
impl Send for WebmachineContext
impl Sync for WebmachineContext
impl Unpin for WebmachineContext
impl !UnwindSafe for WebmachineContext
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§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more