pub struct EnrichedHeaders { /* private fields */ }
Expand description
An HTTP/3 HEADERS frame with decoded headers and a HeaderMap.
Implementations§
Source§impl EnrichedHeaders
impl EnrichedHeaders
Sourcepub fn headers(&self) -> &[Header]
pub fn headers(&self) -> &[Header]
Return the array of headers in this frame.
§Examples
use h3i::frame::EnrichedHeaders;
use quiche::h3::Header;
let raw = vec![
Header::new(b"new jersey", b"devils"),
Header::new(b"new york", b"jets"),
];
let headers = EnrichedHeaders::from(raw.clone());
assert_eq!(headers.headers(), raw);
Sourcepub fn header_map(&self) -> &HeaderMap
pub fn header_map(&self) -> &HeaderMap
Returns a multi-map of header keys to values.
If a single key contains multiple values, the values in the entry will
be returned in the same order as they appear in the array of headers
which backs the EnrichedHeaders
.
§Examples
use h3i::frame::EnrichedHeaders;
use h3i::frame::H3iFrame;
use multimap::MultiMap;
use quiche::h3::Header;
use std::iter::FromIterator;
let header_frame = vec![
Header::new(b":status", b"200"),
Header::new(b"hello", b"world"),
Header::new(b"hello", b"super-earth"),
];
let enriched = H3iFrame::Headers(header_frame.into())
.to_enriched_headers()
.unwrap();
let expected = MultiMap::from_iter([
(b":status".to_vec(), vec![b"200".to_vec()]),
(b"hello".to_vec(), vec![
b"world".to_vec(),
b"super-earth".to_vec(),
]),
]);
assert_eq!(*enriched.header_map(), expected);
Sourcepub fn status_code(&self) -> Option<&Vec<u8>>
pub fn status_code(&self) -> Option<&Vec<u8>>
Fetches the value of the :status
pseudo-header.
§Examples
use h3i::frame::EnrichedHeaders;
use quiche::h3::Header;
let headers = EnrichedHeaders::from(vec![Header::new(b"hello", b"world")]);
assert!(headers.status_code().is_none());
let headers = EnrichedHeaders::from(vec![Header::new(b":status", b"200")]);
assert_eq!(headers.status_code().expect("status code is Some"), b"200");
Trait Implementations§
Source§impl Clone for EnrichedHeaders
impl Clone for EnrichedHeaders
Source§fn clone(&self) -> EnrichedHeaders
fn clone(&self) -> EnrichedHeaders
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for EnrichedHeaders
impl Debug for EnrichedHeaders
Source§impl PartialEq for EnrichedHeaders
impl PartialEq for EnrichedHeaders
Source§impl Serialize for EnrichedHeaders
impl Serialize for EnrichedHeaders
Source§impl TryFrom<Frame> for EnrichedHeaders
impl TryFrom<Frame> for EnrichedHeaders
impl Eq for EnrichedHeaders
impl StructuralPartialEq for EnrichedHeaders
Auto Trait Implementations§
impl Freeze for EnrichedHeaders
impl RefUnwindSafe for EnrichedHeaders
impl Send for EnrichedHeaders
impl Sync for EnrichedHeaders
impl Unpin for EnrichedHeaders
impl UnwindSafe for EnrichedHeaders
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more