pub struct BootRequest {
pub method: HttpMethod,
pub path: String,
pub query_string: Option<String>,
pub query: BTreeMap<String, String>,
pub params: BTreeMap<String, String>,
pub host_params: BTreeMap<String, String>,
pub headers: BTreeMap<String, String>,
pub appended_headers: Vec<(String, String)>,
pub body: Vec<u8>,
/* private fields */
}Expand description
Framework-neutral HTTP request passed to Boot route handlers.
Fields§
§method: HttpMethod§path: String§query_string: Option<String>§query: BTreeMap<String, String>§params: BTreeMap<String, String>§host_params: BTreeMap<String, String>§headers: BTreeMap<String, String>§appended_headers: Vec<(String, String)>§body: Vec<u8>Implementations§
Source§impl BootRequest
impl BootRequest
pub fn new(method: HttpMethod, path: impl Into<String>) -> Self
pub fn method(&self) -> HttpMethod
pub fn path(&self) -> &str
pub fn query_string(&self) -> Option<&str>
pub fn with_query_string(self, query_string: impl Into<String>) -> Self
pub fn module_ref(&self) -> Option<&ModuleRef>
Sourcepub fn context_id(&self) -> Option<&ContextId>
pub fn context_id(&self) -> Option<&ContextId>
Dependency-injection context attached while this request is dispatched.
pub fn get<T>(&self) -> Result<Arc<T>>
pub fn get_named<T>(&self, token: &str) -> Result<Arc<T>>
pub fn get_optional<T>(&self) -> Result<Option<Arc<T>>>
pub fn get_optional_named<T>(&self, token: &str) -> Result<Option<Arc<T>>>
pub fn with_path_params(self, params: BTreeMap<String, String>) -> Self
pub fn with_host_params(self, params: BTreeMap<String, String>) -> Self
pub fn with_param( self, name: impl Into<String>, value: impl Into<String>, ) -> Self
pub fn with_host_param( self, name: impl Into<String>, value: impl Into<String>, ) -> Self
pub fn with_query_param( self, name: impl Into<String>, value: impl Into<String>, ) -> Self
pub fn with_body(self, body: impl Into<Vec<u8>>) -> Self
pub fn body(&self) -> &[u8] ⓘ
pub fn into_body(self) -> Vec<u8> ⓘ
pub fn with_text(self, body: impl Into<String>) -> Self
pub fn with_json<T>(self, body: &T) -> Result<Self>where
T: Serialize,
pub fn with_content_type(self, content_type: impl Into<String>) -> Self
pub fn with_content_length(self, content_length: u64) -> Self
pub fn with_header( self, name: impl Into<String>, value: impl Into<String>, ) -> Self
pub fn with_headers(self, headers: BTreeMap<String, String>) -> Self
pub fn append_header( self, name: impl Into<String>, value: impl Into<String>, ) -> Self
pub fn header_entries(&self) -> impl Iterator<Item = (&str, &str)>
pub fn validate_headers(&self) -> Result<()>
pub fn text(&self) -> Result<String>
pub fn param(&self, name: &str) -> Option<&str>
pub fn param_as<T>(&self, name: &str) -> Result<T>
pub fn optional_param_as<T>(&self, name: &str) -> Result<Option<T>>
pub fn host_param(&self, name: &str) -> Option<&str>
pub fn host_param_as<T>(&self, name: &str) -> Result<T>
pub fn optional_host_param_as<T>(&self, name: &str) -> Result<Option<T>>
pub fn params<T>(&self) -> Result<T>where
T: DeserializeOwned,
pub fn validated_params<T>(&self) -> Result<T>where
T: DeserializeOwned + Validate,
pub fn host_params<T>(&self) -> Result<T>where
T: DeserializeOwned,
pub fn validated_host_params<T>(&self) -> Result<T>where
T: DeserializeOwned + Validate,
pub fn query_param(&self, name: &str) -> Option<&str>
pub fn query_value(&self, name: &str) -> Result<Option<String>>
pub fn query_value_as<T>(&self, name: &str) -> Result<T>
pub fn optional_query_value_as<T>(&self, name: &str) -> Result<Option<T>>
pub fn query_values(&self, name: &str) -> Result<Vec<String>>
pub fn query_values_as<T>(&self, name: &str) -> Result<Vec<T>>
pub fn query_pairs(&self) -> Result<Vec<(String, String)>>
pub fn header(&self, name: &str) -> Option<&str>
pub fn header_as<T>(&self, name: &str) -> Result<T>
pub fn optional_header_as<T>(&self, name: &str) -> Result<Option<T>>
pub fn host(&self) -> Option<&str>
pub fn ip(&self) -> Option<String>
pub fn ip_as<T>(&self) -> Result<T>
pub fn optional_ip_as<T>(&self) -> Result<Option<T>>
pub fn header_values(&self, name: &str) -> Vec<&str>
pub fn bearer_token(&self) -> Option<&str>
pub fn require_bearer_token(&self) -> Result<&str>
pub fn content_type(&self) -> Option<&str>
pub fn content_length(&self) -> Result<Option<u64>>
pub fn strict_content_length(&self) -> Result<Option<u64>>
pub fn validate_content_length(&self) -> Result<()>
pub fn validate_body_limit(&self, body_limit: usize) -> Result<()>
pub fn validate(&self) -> Result<()>
pub fn validate_with_body_limit(&self, body_limit: usize) -> Result<()>
pub fn is_content_type(&self, media_type: &str) -> bool
pub fn is_json_content_type(&self) -> bool
pub fn require_json_content_type(&self) -> Result<()>
pub fn accepts_json(&self) -> bool
pub fn require_accepts_json(&self) -> Result<()>
pub fn accepts_event_stream(&self) -> bool
pub fn require_accepts_event_stream(&self) -> Result<()>
pub fn json<T>(&self) -> Result<T>where
T: DeserializeOwned,
pub fn validated_json<T>(&self) -> Result<T>where
T: DeserializeOwned + Validate,
pub fn json_with_content_type<T>(&self) -> Result<T>where
T: DeserializeOwned,
pub fn validated_json_with_content_type<T>(&self) -> Result<T>where
T: DeserializeOwned + Validate,
pub fn query<T>(&self) -> Result<T>where
T: DeserializeOwned,
pub fn validated_query<T>(&self) -> Result<T>where
T: DeserializeOwned + Validate,
Source§impl BootRequest
impl BootRequest
pub fn body_field(&self, name: &str) -> Result<Option<Value>>
pub fn body_field_as<T>(&self, name: &str) -> Result<T>where
T: DeserializeOwned,
pub fn optional_body_field_as<T>(&self, name: &str) -> Result<Option<T>>where
T: DeserializeOwned,
pub fn body_field_string(&self, name: &str) -> Result<String>
pub fn optional_body_field_string(&self, name: &str) -> Result<Option<String>>
Source§impl BootRequest
impl BootRequest
Trait Implementations§
Source§impl Clone for BootRequest
impl Clone for BootRequest
Source§fn clone(&self) -> BootRequest
fn clone(&self) -> BootRequest
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 BootRequest
impl Debug for BootRequest
impl Eq for BootRequest
Auto Trait Implementations§
impl Freeze for BootRequest
impl RefUnwindSafe for BootRequest
impl Send for BootRequest
impl Sync for BootRequest
impl Unpin for BootRequest
impl UnsafeUnpin for BootRequest
impl UnwindSafe for BootRequest
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