Skip to main content

BootRequest

Struct BootRequest 

Source
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

Source

pub fn new(method: HttpMethod, path: impl Into<String>) -> Self

Source

pub fn method(&self) -> HttpMethod

Source

pub fn path(&self) -> &str

Source

pub fn query_string(&self) -> Option<&str>

Source

pub fn with_query_string(self, query_string: impl Into<String>) -> Self

Source

pub fn module_ref(&self) -> Option<&ModuleRef>

Source

pub fn context_id(&self) -> Option<&ContextId>

Dependency-injection context attached while this request is dispatched.

Source

pub fn get<T>(&self) -> Result<Arc<T>>
where T: Send + Sync + 'static,

Source

pub fn get_named<T>(&self, token: &str) -> Result<Arc<T>>
where T: Send + Sync + 'static,

Source

pub fn get_optional<T>(&self) -> Result<Option<Arc<T>>>
where T: Send + Sync + 'static,

Source

pub fn get_optional_named<T>(&self, token: &str) -> Result<Option<Arc<T>>>
where T: Send + Sync + 'static,

Source

pub fn with_path_params(self, params: BTreeMap<String, String>) -> Self

Source

pub fn with_host_params(self, params: BTreeMap<String, String>) -> Self

Source

pub fn with_param( self, name: impl Into<String>, value: impl Into<String>, ) -> Self

Source

pub fn with_host_param( self, name: impl Into<String>, value: impl Into<String>, ) -> Self

Source

pub fn with_query_param( self, name: impl Into<String>, value: impl Into<String>, ) -> Self

Source

pub fn with_body(self, body: impl Into<Vec<u8>>) -> Self

Source

pub fn body(&self) -> &[u8]

Source

pub fn into_body(self) -> Vec<u8>

Source

pub fn with_text(self, body: impl Into<String>) -> Self

Source

pub fn with_json<T>(self, body: &T) -> Result<Self>
where T: Serialize,

Source

pub fn with_content_type(self, content_type: impl Into<String>) -> Self

Source

pub fn with_content_length(self, content_length: u64) -> Self

Source

pub fn with_header( self, name: impl Into<String>, value: impl Into<String>, ) -> Self

Source

pub fn with_headers(self, headers: BTreeMap<String, String>) -> Self

Source

pub fn append_header( self, name: impl Into<String>, value: impl Into<String>, ) -> Self

Source

pub fn header_entries(&self) -> impl Iterator<Item = (&str, &str)>

Source

pub fn validate_headers(&self) -> Result<()>

Source

pub fn text(&self) -> Result<String>

Source

pub fn param(&self, name: &str) -> Option<&str>

Source

pub fn param_as<T>(&self, name: &str) -> Result<T>
where T: FromStr, T::Err: Display,

Source

pub fn optional_param_as<T>(&self, name: &str) -> Result<Option<T>>
where T: FromStr, T::Err: Display,

Source

pub fn host_param(&self, name: &str) -> Option<&str>

Source

pub fn host_param_as<T>(&self, name: &str) -> Result<T>
where T: FromStr, T::Err: Display,

Source

pub fn optional_host_param_as<T>(&self, name: &str) -> Result<Option<T>>
where T: FromStr, T::Err: Display,

Source

pub fn params<T>(&self) -> Result<T>

Source

pub fn validated_params<T>(&self) -> Result<T>

Source

pub fn host_params<T>(&self) -> Result<T>

Source

pub fn validated_host_params<T>(&self) -> Result<T>

Source

pub fn query_param(&self, name: &str) -> Option<&str>

Source

pub fn query_value(&self, name: &str) -> Result<Option<String>>

Source

pub fn query_value_as<T>(&self, name: &str) -> Result<T>
where T: FromStr, T::Err: Display,

Source

pub fn optional_query_value_as<T>(&self, name: &str) -> Result<Option<T>>
where T: FromStr, T::Err: Display,

Source

pub fn query_values(&self, name: &str) -> Result<Vec<String>>

Source

pub fn query_values_as<T>(&self, name: &str) -> Result<Vec<T>>
where T: FromStr, T::Err: Display,

Source

pub fn query_pairs(&self) -> Result<Vec<(String, String)>>

Source

pub fn header(&self, name: &str) -> Option<&str>

Source

pub fn header_as<T>(&self, name: &str) -> Result<T>
where T: FromStr, T::Err: Display,

Source

pub fn optional_header_as<T>(&self, name: &str) -> Result<Option<T>>
where T: FromStr, T::Err: Display,

Source

pub fn host(&self) -> Option<&str>

Source

pub fn ip(&self) -> Option<String>

Source

pub fn ip_as<T>(&self) -> Result<T>
where T: FromStr, T::Err: Display,

Source

pub fn optional_ip_as<T>(&self) -> Result<Option<T>>
where T: FromStr, T::Err: Display,

Source

pub fn header_values(&self, name: &str) -> Vec<&str>

Source

pub fn authorization(&self) -> Option<&str>

Source

pub fn bearer_token(&self) -> Option<&str>

Source

pub fn require_bearer_token(&self) -> Result<&str>

Source

pub fn content_type(&self) -> Option<&str>

Source

pub fn content_length(&self) -> Result<Option<u64>>

Source

pub fn strict_content_length(&self) -> Result<Option<u64>>

Source

pub fn validate_content_length(&self) -> Result<()>

Source

pub fn validate_body_limit(&self, body_limit: usize) -> Result<()>

Source

pub fn validate(&self) -> Result<()>

Source

pub fn validate_with_body_limit(&self, body_limit: usize) -> Result<()>

Source

pub fn is_content_type(&self, media_type: &str) -> bool

Source

pub fn is_json_content_type(&self) -> bool

Source

pub fn require_json_content_type(&self) -> Result<()>

Source

pub fn accepts_json(&self) -> bool

Source

pub fn require_accepts_json(&self) -> Result<()>

Source

pub fn accepts_event_stream(&self) -> bool

Source

pub fn require_accepts_event_stream(&self) -> Result<()>

Source

pub fn json<T>(&self) -> Result<T>

Source

pub fn validated_json<T>(&self) -> Result<T>

Source

pub fn json_with_content_type<T>(&self) -> Result<T>

Source

pub fn validated_json_with_content_type<T>(&self) -> Result<T>

Source

pub fn query<T>(&self) -> Result<T>

Source

pub fn validated_query<T>(&self) -> Result<T>

Source§

impl BootRequest

Source

pub fn body_field(&self, name: &str) -> Result<Option<Value>>

Source

pub fn body_field_as<T>(&self, name: &str) -> Result<T>

Source

pub fn optional_body_field_as<T>(&self, name: &str) -> Result<Option<T>>

Source

pub fn body_field_string(&self, name: &str) -> Result<String>

Source

pub fn optional_body_field_string(&self, name: &str) -> Result<Option<String>>

Source§

impl BootRequest

Source

pub fn cookie_pairs(&self) -> Result<Vec<(String, String)>>

Source

pub fn cookie(&self, name: &str) -> Result<Option<String>>

Source

pub fn cookie_as<T>(&self, name: &str) -> Result<T>
where T: FromStr, T::Err: Display,

Source

pub fn cookie_values(&self, name: &str) -> Result<Vec<String>>

Source

pub fn cookie_values_as<T>(&self, name: &str) -> Result<Vec<T>>
where T: FromStr, T::Err: Display,

Source

pub fn cookies(&self) -> Result<BTreeMap<String, String>>

Trait Implementations§

Source§

impl Clone for BootRequest

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl Debug for BootRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for BootRequest

Source§

impl PartialEq for BootRequest

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more