Struct http_types::other::Expect
source · pub struct Expect { /* private fields */ }
Expand description
HTTP Expect
header
Specifications
Examples
use http_types::Response;
use http_types::other::Expect;
let expect = Expect::new();
let mut res = Response::new(200);
expect.apply(&mut res);
let expect = Expect::from_headers(res)?.unwrap();
assert_eq!(expect, Expect::new());
Implementations§
source§impl Expect
impl Expect
sourcepub fn from_headers(headers: impl AsRef<Headers>) -> Result<Option<Self>>
pub fn from_headers(headers: impl AsRef<Headers>) -> Result<Option<Self>>
Create an instance of Expect
from a Headers
instance.
sourcepub fn apply(&self, headers: impl AsMut<Headers>)
pub fn apply(&self, headers: impl AsMut<Headers>)
Insert a HeaderName
+ HeaderValue
pair into a Headers
instance.
sourcepub fn name(&self) -> HeaderName
pub fn name(&self) -> HeaderName
Get the HeaderName
.
sourcepub fn value(&self) -> HeaderValue
pub fn value(&self) -> HeaderValue
Get the HeaderValue
.
Trait Implementations§
source§impl Ord for Expect
impl Ord for Expect
source§impl PartialEq<Expect> for Expect
impl PartialEq<Expect> for Expect
source§impl PartialOrd<Expect> for Expect
impl PartialOrd<Expect> for Expect
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl ToHeaderValues for Expect
impl ToHeaderValues for Expect
§type Iter = IntoIter<HeaderValue>
type Iter = IntoIter<HeaderValue>
Returned iterator over header values which this type may correspond to.
source§fn to_header_values(&self) -> Result<Self::Iter>
fn to_header_values(&self) -> Result<Self::Iter>
Converts this object to an iterator of resolved
HeaderValues
.impl Eq for Expect
impl StructuralEq for Expect
impl StructuralPartialEq for Expect
Auto Trait Implementations§
impl RefUnwindSafe for Expect
impl Send for Expect
impl Sync for Expect
impl Unpin for Expect
impl UnwindSafe for Expect
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