pub struct Request {
    pub inner: InnerRequest,
    pub body: Body,
    pub metar: MetaRequest,
    /* private fields */
}
Expand description

An Wrapper of http::Request

An HTTP request consists of a head and a potentially optional body. The body component is generic, enabling arbitrary types to represent the HTTP body. For example, the body could be Vec, a Stream of byte chunks, or a value that has been deserialized. Generally, Affix and Task roughly add up to a Request,

Fields

inner: InnerRequestbody: Bodymetar: MetaRequest

Implementations

Create an instance of RequestBuilder that used to build a Request

Examples
let request = Request::default();
    .body(());

get shared reference to body of RequestBuilder

Examples
let request = Request::default();
assert!(request.body().is_none());

get mutable reference to body of RequestBuilder

Examples
let request = Request::default();
request.body_mut() = 3;
assert!(request.body_mut().is_none());

get shared reference to extensions of RequestBuilder

Examples
struct S {}
let request = Request::default();
    .body(());
let s = S {};
request.extensions_mut.insert(s);
assert_eq!(request.extensions().get::<S>(), &s);

get mutable reference to extensions of RequestBuilder

Examples
let request = Request::default();
    .body(());
request.extensions_mut().insert(vec![1,2,3]);
assert_eq!(request.extensions().get::<Vec<_>>(), &vec![1,2,3]);

get shared reference to exts of RequestBuilder

Examples
struct S {}
let request = Request::default();
    .body(());
let s = S {};
request.exts_mut.insert(s);
assert_eq!(request.exts().get::<S>(), &s);

get mutable reference to exts of RequestBuilder

Examples
let request = Request::default();
    .body(());
request.exts_mut().insert(vec![1,2,3]);
assert_eq!(request.exts().get::<Vec<_>>(), &vec![1,2,3]);

get shared reference to body_fn of Request

Examples
let reqeust = Request::default();
    .body_fn(body_fn)
    .body(());
assert_eq!(*reqeust.body_fn(), body_fn);

set the body_fn of Request,

Examples
let req = Request::default();
    .as_mut()
    .body_fn_mut(body_fn);
assert_eq!(*Request.body_fn(), body_fn);

get shared reference to info of Request

Examples
let request = request::default();
assert_eq!(request.info().used, 0);

get mutable reference to info of Request

Examples
let request = request::default();
request.info_mut().unique = false;
assert_eq!(*request.info_ref().unique, false);

Consume the request and obtain the body

Examples
let request = request::default();
assert!(request.into_body().is_empty());

Convert the body of the request with function

Examples
let request = request::default();
let new= request.map(|v| v + 1 );
assert_eq!(new.body, vec![2,3,4]);

Create new Request directly with body, inner data (require feature proxy enabled)

Examples
let request = request::default();
let ( mut inner, body, meta ) = request.into_parts();
let _ = request::from_parts(inner, body, meta);

split request into body, inner data, (require feature proxy enabled)

Examples
let request = request::default();
let (_inner, _body, _meta ) = request.into_parts();

Create new Request directly with Task and Affix(Optional)

Examples
let request = request::default();
let ( mut inner, body, meta ) = request.into_parts();
let _ = request::from_parts(inner, body, meta);
Available on crate feature proxy only.

get the unique client id that will execute the request

Available on crate feature proxy only.

get the client to execute the request

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Converts to this type from the input type.

transform a Request into hyper::Request

Serialize this value into the given Serde serializer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

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

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

Calls U::from(self).

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

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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

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