iron::request

Struct Request

Source
pub struct Request<'a, 'b: 'a> {
    pub url: Url,
    pub remote_addr: SocketAddr,
    pub local_addr: SocketAddr,
    pub headers: Headers,
    pub body: Body<'a, 'b>,
    pub method: Method,
    pub extensions: TypeMap,
    pub version: HttpVersion,
    /* private fields */
}
Expand description

The Request given to all Middleware.

Stores all the properties of the client’s request plus an TypeMap for data communication between middleware.

Fields§

§url: Url

The requested URL.

§remote_addr: SocketAddr

The originating address of the request.

§local_addr: SocketAddr

The local address of the request.

§headers: Headers

The request headers.

§body: Body<'a, 'b>

The request body as a reader.

§method: Method

The request method.

§extensions: TypeMap

Extensible storage for data passed between middleware.

§version: HttpVersion

The version of the HTTP protocol used.

Implementations§

Source§

impl<'a, 'b> Request<'a, 'b>

Source

pub fn from_http( req: HttpRequest<'a, 'b>, local_addr: SocketAddr, protocol: &Protocol, ) -> Result<Request<'a, 'b>, String>

Create a request from an HttpRequest.

This constructor consumes the HttpRequest.

Trait Implementations§

Source§

impl<'a, 'b> Debug for Request<'a, 'b>

Source§

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

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

impl<'a, 'b> Extensible for Request<'a, 'b>

Source§

fn extensions(&self) -> &TypeMap

Get a reference to the type’s extension storage.
Source§

fn extensions_mut(&mut self) -> &mut TypeMap

Get a mutable reference to the type’s extension storage.
Source§

impl<'a, 'b, H> Modifier<Request<'a, 'b>> for Header<H>
where H: Header + HeaderFormat,

Source§

fn modify(self, res: &mut Request<'_, '_>)

Modify F with self.
Source§

impl<'a, 'b> Pluggable for Request<'a, 'b>

Source§

fn get<P>(&mut self) -> Result<<P as Key>::Value, <P as Plugin<Self>>::Error>
where P: Plugin<Self>, <P as Key>::Value: Clone + Any, Self: Extensible,

Return a copy of the plugin’s produced value. Read more
Source§

fn get_ref<P>( &mut self, ) -> Result<&<P as Key>::Value, <P as Plugin<Self>>::Error>
where P: Plugin<Self>, <P as Key>::Value: Any, Self: Extensible,

Return a reference to the plugin’s produced value. Read more
Source§

fn get_mut<P>( &mut self, ) -> Result<&mut <P as Key>::Value, <P as Plugin<Self>>::Error>
where P: Plugin<Self>, <P as Key>::Value: Any, Self: Extensible,

Return a mutable reference to the plugin’s produced value. Read more
Source§

fn compute<P>( &mut self, ) -> Result<<P as Key>::Value, <P as Plugin<Self>>::Error>
where P: Plugin<Self>,

Create and evaluate a once-off instance of a plugin.
Source§

impl<'a, 'b> Set for Request<'a, 'b>

Source§

fn set<M>(self, modifier: M) -> Self
where M: Modifier<Self>, Self: Sized,

Modify self using the provided modifier.
Source§

fn set_mut<M>(&mut self, modifier: M) -> &mut Self
where M: Modifier<Self>,

Modify self through a mutable reference with the provided modifier.

Auto Trait Implementations§

§

impl<'a, 'b> Freeze for Request<'a, 'b>

§

impl<'a, 'b> !RefUnwindSafe for Request<'a, 'b>

§

impl<'a, 'b> !Send for Request<'a, 'b>

§

impl<'a, 'b> !Sync for Request<'a, 'b>

§

impl<'a, 'b> Unpin for Request<'a, 'b>

§

impl<'a, 'b> !UnwindSafe for Request<'a, 'b>

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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<T> Typeable for T
where T: Any,

Source§

fn get_type(&self) -> TypeId

Get the TypeId of this object.
Source§

impl<T> DebugAny for T
where T: Any + Debug,

Source§

impl<T> UnsafeAny for T
where T: Any,