[][src]Struct saphir::SyncRequest

pub struct SyncRequest { /* fields omitted */ }

A Structure which represent an http request with a fully loaded body

Methods

impl SyncRequest
[src]

Construct a new Request.

Returns a reference to the associated HTTP method.

Examples

let request: Request<()> = Request::default();
assert_eq!(*request.method(), Method::GET);

Returns a mutable reference to the associated HTTP method.

Examples

let mut request: Request<()> = Request::default();
*request.method_mut() = Method::PUT;
assert_eq!(*request.method(), Method::PUT);

Returns a reference to the associated URI.

Examples

let request: Request<()> = Request::default();
assert_eq!(*request.uri(), *"/");

Returns a mutable reference to the associated URI.

Examples

let mut request: Request<()> = Request::default();
*request.uri_mut() = "/hello".parse().unwrap();
assert_eq!(*request.uri(), *"/hello");

Important traits for Vec<u8>

Returns the associated version.

Examples

let request: Request<()> = Request::default();
assert_eq!(request.version(), Version::HTTP_11);

Returns a mutable reference to the associated version.

Examples

let mut request: Request<()> = Request::default();
*request.version_mut() = Version::HTTP_2;
assert_eq!(request.version(), Version::HTTP_2);

Returns a reference to the associated header field map.

Examples

let request: Request<()> = Request::default();
assert!(request.headers().is_empty());

Returns a mutable reference to the associated header field map.

Examples

let mut request: Request<()> = Request::default();
request.headers_mut().insert(HOST, HeaderValue::from_static("world"));
assert!(!request.headers().is_empty());

Clone the HeaderMap and convert it to a more dev-friendly Headers struct

Insert a dev-friendly Headers to the HeaderMap

Returns a reference to the associated extensions.

Examples

let request: Request<()> = Request::default();
assert!(request.extensions().get::<i32>().is_none());

Returns a mutable reference to the associated extensions.

Examples

let mut request: Request<()> = Request::default();
request.extensions_mut().insert("hello");
assert_eq!(request.extensions().get(), Some(&"hello"));

Important traits for Vec<u8>

Returns a reference to the associated HTTP body.

Examples

let request: Request<String> = Request::default();
assert!(request.body().is_empty());

Important traits for Vec<u8>

Returns a mutable reference to the associated HTTP body.

Examples

let mut request: Request<String> = Request::default();
request.body_mut().push_str("hello world");
assert!(!request.body().is_empty());

Returns a reference to the request add-ons

Returns a reference to the request add-ons

Trait Implementations

impl Debug for SyncRequest
[src]

Auto Trait Implementations

impl Send for SyncRequest

impl !Sync for SyncRequest

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T