pub struct RequestContext {
pub method: String,
pub path: String,
pub query: String,
pub hash: String,
pub secure: bool,
pub headers: Vec<(String, String)>,
pub cookies: Vec<(String, String)>,
pub body: String,
}Expand description
What is known about the request being rendered for.
Header and cookie names are compared without regard to case, which is what HTTP says they mean.
Fields§
§method: StringRequest method, uppercased.
path: StringRequested path, without the query string.
query: StringQuery string, without the leading ?.
hash: StringFragment, without the leading #.
secure: boolWhether the request arrived over TLS.
headers: Vec<(String, String)>The headers the app may read, in the order they arrived.
The cookies the app may read, in the order they arrived.
body: StringThe request body, empty when there was none.
Implementations§
Source§impl RequestContext
impl RequestContext
Sourcepub fn header(&self, name: &str) -> Option<&str>
pub fn header(&self, name: &str) -> Option<&str>
The value of a header, or None when it did not arrive or the app is
not allowed to read it.
The value of a cookie, or None when it did not arrive.
Sourcepub fn publish(&self, store: &mut PropertyStore)
pub fn publish(&self, store: &mut PropertyStore)
Write the reserved cells, so markup and derivations can read them.
Called before the app’s first tick, which is what lets an on_start
branch on the address it was asked for.
Trait Implementations§
Source§impl Clone for RequestContext
impl Clone for RequestContext
Source§fn clone(&self) -> RequestContext
fn clone(&self) -> RequestContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RequestContext
impl Debug for RequestContext
Source§impl Default for RequestContext
impl Default for RequestContext
Source§fn default() -> RequestContext
fn default() -> RequestContext
Source§impl PartialEq for RequestContext
impl PartialEq for RequestContext
Source§fn eq(&self, other: &RequestContext) -> bool
fn eq(&self, other: &RequestContext) -> bool
self and other values to be equal, and is used by ==.impl Eq for RequestContext
impl StructuralPartialEq for RequestContext
Auto Trait Implementations§
impl Freeze for RequestContext
impl RefUnwindSafe for RequestContext
impl Send for RequestContext
impl Sync for RequestContext
impl Unpin for RequestContext
impl UnsafeUnpin for RequestContext
impl UnwindSafe for RequestContext
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> DynEq for T
impl<T> DynEq for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> FromTemplate for T
impl<T> FromTemplate for T
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
§impl<T> Template for T
impl<T> Template for T
§fn build_template(
&self,
_context: &mut TemplateContext<'_, '_>,
) -> Result<<T as Template>::Output, BevyError>
fn build_template( &self, _context: &mut TemplateContext<'_, '_>, ) -> Result<<T as Template>::Output, BevyError>
entity context to produce a Template::Output.§fn clone_template(&self) -> T
fn clone_template(&self) -> T
Clone.