[][src]Struct envoy_sdk::host::HeaderMap

pub struct HeaderMap { /* fields omitted */ }

Implementations

impl HeaderMap[src]

pub fn builder() -> HeaderMapBuilder[src]

pub fn new() -> Self[src]

pub fn with_capacity(capacity: usize) -> Self[src]

pub fn is_empty(&self) -> bool[src]

pub fn len(&self) -> usize[src]

pub fn as_slice(&self) -> &[(ByteString, ByteString)][src]

pub fn into_vec(self) -> Vec<(ByteString, ByteString)>[src]

pub fn iter(&self) -> Iter<'_>[src]

pub fn get<Q>(&self, key: Q) -> Option<&ByteString> where
    Q: AsRef<[u8]>, 
[src]

Returns a reference to the header value.

Examples

use envoy::host::HeaderMap;

let mut headers = HeaderMap::builder()
    .header(":authority", "example.org")
    .build();

assert_eq!(headers.get(":authority"), Some(&"example.org".into()));
assert_eq!(headers.get(":method"), None);

pub fn insert<K, V>(&mut self, key: K, value: V) -> Option<ByteString> where
    K: Into<ByteString>,
    V: Into<ByteString>, 
[src]

Inserts a header.

If the header has not ben present before, None is returned. Otherwise, the value is updated, and the old value is returned.

Examples

use envoy::host::HeaderMap;

let mut headers = HeaderMap::builder()
    .header(":authority", "example.org")
    .build();

assert_eq!(headers.insert(":authority", "example.com"), Some("example.org".into()));
assert_eq!(headers.insert(":method", "GET"), None);

pub fn remove<Q>(&mut self, key: Q) -> Option<ByteString> where
    Q: AsRef<[u8]>, 
[src]

Removes a header by name, returning its value.

Examples

use envoy::host::HeaderMap;

let mut headers = HeaderMap::builder()
    .header(":authority", "example.org")
    .header(":method", "GET")
    .build();

assert_eq!(headers.remove(":authority"), Some("example.org".into()));
assert_eq!(headers.remove("content-type"), None);

Trait Implementations

impl Clone for HeaderMap[src]

impl Debug for HeaderMap[src]

impl Default for HeaderMap[src]

impl Eq for HeaderMap[src]

impl<'_, '_, '_> From<&'_ [(&'_ str, &'_ str)]> for HeaderMap[src]

impl<'_> From<&'_ HeaderMap> for HeaderMap[src]

impl From<Vec<(ByteString, ByteString)>> for HeaderMap[src]

impl<'a> FromIterator<&'a (&'a str, &'a str)> for HeaderMap[src]

impl FromIterator<(ByteString, ByteString)> for HeaderMap[src]

impl<'a> IntoIterator for &'a HeaderMap[src]

type Item = (&'a ByteString, &'a ByteString)

The type of the elements being iterated over.

type IntoIter = Iter<'a>

Which kind of iterator are we turning this into?

impl IntoIterator for HeaderMap[src]

type Item = (ByteString, ByteString)

The type of the elements being iterated over.

type IntoIter = IntoIter

Which kind of iterator are we turning this into?

impl PartialEq<HeaderMap> for HeaderMap[src]

impl StructuralEq for HeaderMap[src]

impl StructuralPartialEq for HeaderMap[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.