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
impl Expect
impl Expect
pub fn from_headers(
headers: impl AsRef<Headers>
) -> Result<Option<Expect>, Error>
pub fn from_headers(
headers: impl AsRef<Headers>
) -> Result<Option<Expect>, Error>
Create an instance of Expect
from a Headers
instance.
pub fn apply(&self, headers: impl AsMut<Headers>)
pub fn apply(&self, headers: impl AsMut<Headers>)
Insert a HeaderName
+ HeaderValue
pair into a Headers
instance.
pub fn name(&self) -> HeaderName
pub fn name(&self) -> HeaderName
Get the HeaderName
.
pub fn value(&self) -> HeaderValue
pub fn value(&self) -> HeaderValue
Get the HeaderValue
.
Trait Implementations
impl Ord for Expect
impl Ord for Expect
impl PartialOrd<Expect> for Expect
impl PartialOrd<Expect> for Expect
fn partial_cmp(&self, other: &Expect) -> Option<Ordering>
fn partial_cmp(&self, other: &Expect) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn 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 more
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.
fn to_header_values(&self) -> Result<<Expect as ToHeaderValues>::Iter, Error>
fn to_header_values(&self) -> Result<<Expect as ToHeaderValues>::Iter, Error>
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more