Struct rama::http::header::HeaderMap

pub struct HeaderMap<T = HeaderValue> { /* private fields */ }
Expand description

A set of HTTP headers

HeaderMap is a multimap of HeaderName to values.

§Examples

Basic usage

let mut headers = HeaderMap::new();

headers.insert(HOST, "example.com".parse().unwrap());
headers.insert(CONTENT_LENGTH, "123".parse().unwrap());

assert!(headers.contains_key(HOST));
assert!(!headers.contains_key(LOCATION));

assert_eq!(headers[HOST], "example.com");

headers.remove(HOST);

assert!(!headers.contains_key(HOST));

Implementations§

§

impl HeaderMap

pub fn new() -> HeaderMap

Create an empty HeaderMap.

The map will be created without any capacity. This function will not allocate.

§Examples
let map = HeaderMap::new();

assert!(map.is_empty());
assert_eq!(0, map.capacity());
§

impl<T> HeaderMap<T>

pub fn with_capacity(capacity: usize) -> HeaderMap<T>

Create an empty HeaderMap with the specified capacity.

The returned map will allocate internal storage in order to hold about capacity elements without reallocating. However, this is a “best effort” as there are usage patterns that could cause additional allocations before capacity headers are stored in the map.

More capacity than requested may be allocated.

§Panics

This method panics if capacity exceeds max HeaderMap capacity.

§Examples
let map: HeaderMap<u32> = HeaderMap::with_capacity(10);

assert!(map.is_empty());
assert_eq!(12, map.capacity());

pub fn try_with_capacity( capacity: usize, ) -> Result<HeaderMap<T>, MaxSizeReached>

Create an empty HeaderMap with the specified capacity.

The returned map will allocate internal storage in order to hold about capacity elements without reallocating. However, this is a “best effort” as there are usage patterns that could cause additional allocations before capacity headers are stored in the map.

More capacity than requested may be allocated.

§Errors

This function may return an error if HeaderMap exceeds max capacity

§Examples
let map: HeaderMap<u32> = HeaderMap::try_with_capacity(10).unwrap();

assert!(map.is_empty());
assert_eq!(12, map.capacity());

pub fn len(&self) -> usize

Returns the number of headers stored in the map.

This number represents the total number of values stored in the map. This number can be greater than or equal to the number of keys stored given that a single key may have more than one associated value.

§Examples
let mut map = HeaderMap::new();

assert_eq!(0, map.len());

map.insert(ACCEPT, "text/plain".parse().unwrap());
map.insert(HOST, "localhost".parse().unwrap());

assert_eq!(2, map.len());

map.append(ACCEPT, "text/html".parse().unwrap());

assert_eq!(3, map.len());

pub fn keys_len(&self) -> usize

Returns the number of keys stored in the map.

This number will be less than or equal to len() as each key may have more than one associated value.

§Examples
let mut map = HeaderMap::new();

assert_eq!(0, map.keys_len());

map.insert(ACCEPT, "text/plain".parse().unwrap());
map.insert(HOST, "localhost".parse().unwrap());

assert_eq!(2, map.keys_len());

map.insert(ACCEPT, "text/html".parse().unwrap());

assert_eq!(2, map.keys_len());

pub fn is_empty(&self) -> bool

Returns true if the map contains no elements.

§Examples
let mut map = HeaderMap::new();

assert!(map.is_empty());

map.insert(HOST, "hello.world".parse().unwrap());

assert!(!map.is_empty());

pub fn clear(&mut self)

Clears the map, removing all key-value pairs. Keeps the allocated memory for reuse.

§Examples
let mut map = HeaderMap::new();
map.insert(HOST, "hello.world".parse().unwrap());

map.clear();
assert!(map.is_empty());
assert!(map.capacity() > 0);

pub fn capacity(&self) -> usize

Returns the number of headers the map can hold without reallocating.

This number is an approximation as certain usage patterns could cause additional allocations before the returned capacity is filled.

§Examples
let mut map = HeaderMap::new();

assert_eq!(0, map.capacity());

map.insert(HOST, "hello.world".parse().unwrap());
assert_eq!(6, map.capacity());

pub fn reserve(&mut self, additional: usize)

Reserves capacity for at least additional more headers to be inserted into the HeaderMap.

The header map may reserve more space to avoid frequent reallocations. Like with with_capacity, this will be a “best effort” to avoid allocations until additional more headers are inserted. Certain usage patterns could cause additional allocations before the number is reached.

§Panics

Panics if the new allocation size overflows HeaderMap MAX_SIZE.

§Examples
let mut map = HeaderMap::new();
map.reserve(10);

pub fn try_reserve(&mut self, additional: usize) -> Result<(), MaxSizeReached>

Reserves capacity for at least additional more headers to be inserted into the HeaderMap.

The header map may reserve more space to avoid frequent reallocations. Like with with_capacity, this will be a “best effort” to avoid allocations until additional more headers are inserted. Certain usage patterns could cause additional allocations before the number is reached.

§Errors

This method differs from reserve by returning an error instead of panicking if the value is too large.

§Examples
let mut map = HeaderMap::new();
map.try_reserve(10).unwrap();

pub fn get<K>(&self, key: K) -> Option<&T>
where K: AsHeaderName,

Returns a reference to the value associated with the key.

If there are multiple values associated with the key, then the first one is returned. Use get_all to get all values associated with a given key. Returns None if there are no values associated with the key.

§Examples
let mut map = HeaderMap::new();
assert!(map.get("host").is_none());

map.insert(HOST, "hello".parse().unwrap());
assert_eq!(map.get(HOST).unwrap(), &"hello");
assert_eq!(map.get("host").unwrap(), &"hello");

map.append(HOST, "world".parse().unwrap());
assert_eq!(map.get("host").unwrap(), &"hello");

pub fn get_mut<K>(&mut self, key: K) -> Option<&mut T>
where K: AsHeaderName,

Returns a mutable reference to the value associated with the key.

If there are multiple values associated with the key, then the first one is returned. Use entry to get all values associated with a given key. Returns None if there are no values associated with the key.

§Examples
let mut map = HeaderMap::default();
map.insert(HOST, "hello".to_string());
map.get_mut("host").unwrap().push_str("-world");

assert_eq!(map.get(HOST).unwrap(), &"hello-world");

pub fn get_all<K>(&self, key: K) -> GetAll<'_, T>
where K: AsHeaderName,

Returns a view of all values associated with a key.

The returned view does not incur any allocations and allows iterating the values associated with the key. See GetAll for more details. Returns None if there are no values associated with the key.

§Examples
let mut map = HeaderMap::new();

map.insert(HOST, "hello".parse().unwrap());
map.append(HOST, "goodbye".parse().unwrap());

let view = map.get_all("host");

let mut iter = view.iter();
assert_eq!(&"hello", iter.next().unwrap());
assert_eq!(&"goodbye", iter.next().unwrap());
assert!(iter.next().is_none());

pub fn contains_key<K>(&self, key: K) -> bool
where K: AsHeaderName,

Returns true if the map contains a value for the specified key.

§Examples
let mut map = HeaderMap::new();
assert!(!map.contains_key(HOST));

map.insert(HOST, "world".parse().unwrap());
assert!(map.contains_key("host"));

pub fn iter(&self) -> Iter<'_, T>

An iterator visiting all key-value pairs.

The iteration order is arbitrary, but consistent across platforms for the same crate version. Each key will be yielded once per associated value. So, if a key has 3 associated values, it will be yielded 3 times.

§Examples
let mut map = HeaderMap::new();

map.insert(HOST, "hello".parse().unwrap());
map.append(HOST, "goodbye".parse().unwrap());
map.insert(CONTENT_LENGTH, "123".parse().unwrap());

for (key, value) in map.iter() {
    println!("{:?}: {:?}", key, value);
}

pub fn iter_mut(&mut self) -> IterMut<'_, T>

An iterator visiting all key-value pairs, with mutable value references.

The iterator order is arbitrary, but consistent across platforms for the same crate version. Each key will be yielded once per associated value, so if a key has 3 associated values, it will be yielded 3 times.

§Examples
let mut map = HeaderMap::default();

map.insert(HOST, "hello".to_string());
map.append(HOST, "goodbye".to_string());
map.insert(CONTENT_LENGTH, "123".to_string());

for (key, value) in map.iter_mut() {
    value.push_str("-boop");
}

pub fn keys(&self) -> Keys<'_, T>

An iterator visiting all keys.

The iteration order is arbitrary, but consistent across platforms for the same crate version. Each key will be yielded only once even if it has multiple associated values.

§Examples
let mut map = HeaderMap::new();

map.insert(HOST, "hello".parse().unwrap());
map.append(HOST, "goodbye".parse().unwrap());
map.insert(CONTENT_LENGTH, "123".parse().unwrap());

for key in map.keys() {
    println!("{:?}", key);
}

pub fn values(&self) -> Values<'_, T>

An iterator visiting all values.

The iteration order is arbitrary, but consistent across platforms for the same crate version.

§Examples
let mut map = HeaderMap::new();

map.insert(HOST, "hello".parse().unwrap());
map.append(HOST, "goodbye".parse().unwrap());
map.insert(CONTENT_LENGTH, "123".parse().unwrap());

for value in map.values() {
    println!("{:?}", value);
}

pub fn values_mut(&mut self) -> ValuesMut<'_, T>

An iterator visiting all values mutably.

The iteration order is arbitrary, but consistent across platforms for the same crate version.

§Examples
let mut map = HeaderMap::default();

map.insert(HOST, "hello".to_string());
map.append(HOST, "goodbye".to_string());
map.insert(CONTENT_LENGTH, "123".to_string());

for value in map.values_mut() {
    value.push_str("-boop");
}

pub fn drain(&mut self) -> Drain<'_, T>

Clears the map, returning all entries as an iterator.

The internal memory is kept for reuse.

For each yielded item that has None provided for the HeaderName, then the associated header name is the same as that of the previously yielded item. The first yielded item will have HeaderName set.

§Examples
let mut map = HeaderMap::new();

map.insert(HOST, "hello".parse().unwrap());
map.append(HOST, "goodbye".parse().unwrap());
map.insert(CONTENT_LENGTH, "123".parse().unwrap());

let mut drain = map.drain();


assert_eq!(drain.next(), Some((Some(HOST), "hello".parse().unwrap())));
assert_eq!(drain.next(), Some((None, "goodbye".parse().unwrap())));

assert_eq!(drain.next(), Some((Some(CONTENT_LENGTH), "123".parse().unwrap())));

assert_eq!(drain.next(), None);

pub fn entry<K>(&mut self, key: K) -> Entry<'_, T>
where K: IntoHeaderName,

Gets the given key’s corresponding entry in the map for in-place manipulation.

§Panics

This method panics if capacity exceeds max HeaderMap capacity

§Examples
let mut map: HeaderMap<u32> = HeaderMap::default();

let headers = &[
    "content-length",
    "x-hello",
    "Content-Length",
    "x-world",
];

for &header in headers {
    let counter = map.entry(header).or_insert(0);
    *counter += 1;
}

assert_eq!(map["content-length"], 2);
assert_eq!(map["x-hello"], 1);

pub fn try_entry<K>( &mut self, key: K, ) -> Result<Entry<'_, T>, InvalidHeaderName>
where K: AsHeaderName,

Gets the given key’s corresponding entry in the map for in-place manipulation.

§Errors

This method differs from entry by allowing types that may not be valid HeaderNames to passed as the key (such as String). If they do not parse as a valid HeaderName, this returns an InvalidHeaderName error.

If reserving space goes over the maximum, this will also return an error. However, to prevent breaking changes to the return type, the error will still say InvalidHeaderName, unlike other try_* methods which return a MaxSizeReached error.

pub fn insert<K>(&mut self, key: K, val: T) -> Option<T>
where K: IntoHeaderName,

Inserts a key-value pair into the map.

If the map did not previously have this key present, then None is returned.

If the map did have this key present, the new value is associated with the key and all previous values are removed. Note that only a single one of the previous values is returned. If there are multiple values that have been previously associated with the key, then the first one is returned. See insert_mult on OccupiedEntry for an API that returns all values.

The key is not updated, though; this matters for types that can be == without being identical.

§Panics

This method panics if capacity exceeds max HeaderMap capacity

§Examples
let mut map = HeaderMap::new();
assert!(map.insert(HOST, "world".parse().unwrap()).is_none());
assert!(!map.is_empty());

let mut prev = map.insert(HOST, "earth".parse().unwrap()).unwrap();
assert_eq!("world", prev);

pub fn try_insert<K>( &mut self, key: K, val: T, ) -> Result<Option<T>, MaxSizeReached>
where K: IntoHeaderName,

Inserts a key-value pair into the map.

If the map did not previously have this key present, then None is returned.

If the map did have this key present, the new value is associated with the key and all previous values are removed. Note that only a single one of the previous values is returned. If there are multiple values that have been previously associated with the key, then the first one is returned. See insert_mult on OccupiedEntry for an API that returns all values.

The key is not updated, though; this matters for types that can be == without being identical.

§Errors

This function may return an error if HeaderMap exceeds max capacity

§Examples
let mut map = HeaderMap::new();
assert!(map.try_insert(HOST, "world".parse().unwrap()).unwrap().is_none());
assert!(!map.is_empty());

let mut prev = map.try_insert(HOST, "earth".parse().unwrap()).unwrap().unwrap();
assert_eq!("world", prev);

pub fn append<K>(&mut self, key: K, value: T) -> bool
where K: IntoHeaderName,

Inserts a key-value pair into the map.

If the map did not previously have this key present, then false is returned.

If the map did have this key present, the new value is pushed to the end of the list of values currently associated with the key. The key is not updated, though; this matters for types that can be == without being identical.

§Panics

This method panics if capacity exceeds max HeaderMap capacity

§Examples
let mut map = HeaderMap::new();
assert!(map.insert(HOST, "world".parse().unwrap()).is_none());
assert!(!map.is_empty());

map.append(HOST, "earth".parse().unwrap());

let values = map.get_all("host");
let mut i = values.iter();
assert_eq!("world", *i.next().unwrap());
assert_eq!("earth", *i.next().unwrap());

pub fn try_append<K>( &mut self, key: K, value: T, ) -> Result<bool, MaxSizeReached>
where K: IntoHeaderName,

Inserts a key-value pair into the map.

If the map did not previously have this key present, then false is returned.

If the map did have this key present, the new value is pushed to the end of the list of values currently associated with the key. The key is not updated, though; this matters for types that can be == without being identical.

§Errors

This function may return an error if HeaderMap exceeds max capacity

§Examples
let mut map = HeaderMap::new();
assert!(map.try_insert(HOST, "world".parse().unwrap()).unwrap().is_none());
assert!(!map.is_empty());

map.try_append(HOST, "earth".parse().unwrap()).unwrap();

let values = map.get_all("host");
let mut i = values.iter();
assert_eq!("world", *i.next().unwrap());
assert_eq!("earth", *i.next().unwrap());

pub fn remove<K>(&mut self, key: K) -> Option<T>
where K: AsHeaderName,

Removes a key from the map, returning the value associated with the key.

Returns None if the map does not contain the key. If there are multiple values associated with the key, then the first one is returned. See remove_entry_mult on OccupiedEntry for an API that yields all values.

§Examples
let mut map = HeaderMap::new();
map.insert(HOST, "hello.world".parse().unwrap());

let prev = map.remove(HOST).unwrap();
assert_eq!("hello.world", prev);

assert!(map.remove(HOST).is_none());

Trait Implementations§

§

impl<T> Clone for HeaderMap<T>
where T: Clone,

§

fn clone(&self) -> HeaderMap<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<T> Debug for HeaderMap<T>
where T: Debug,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<T> Default for HeaderMap<T>

§

fn default() -> HeaderMap<T>

Returns the “default value” for a type. Read more
§

impl<T> Extend<(HeaderName, T)> for HeaderMap<T>

§

fn extend<I>(&mut self, iter: I)
where I: IntoIterator<Item = (HeaderName, T)>,

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
§

impl<T> Extend<(Option<HeaderName>, T)> for HeaderMap<T>

§

fn extend<I>(&mut self, iter: I)
where I: IntoIterator<Item = (Option<HeaderName>, T)>,

Extend a HeaderMap with the contents of another HeaderMap.

This function expects the yielded items to follow the same structure as IntoIter.

§Panics

This panics if the first yielded item does not have a HeaderName.

§Examples
let mut map = HeaderMap::new();

map.insert(ACCEPT, "text/plain".parse().unwrap());
map.insert(HOST, "hello.world".parse().unwrap());

let mut extra = HeaderMap::new();

extra.insert(HOST, "foo.bar".parse().unwrap());
extra.insert(COOKIE, "hello".parse().unwrap());
extra.append(COOKIE, "world".parse().unwrap());

map.extend(extra);

assert_eq!(map["host"], "foo.bar");
assert_eq!(map["accept"], "text/plain");
assert_eq!(map["cookie"], "hello");

let v = map.get_all("host");
assert_eq!(1, v.iter().count());

let v = map.get_all("cookie");
assert_eq!(2, v.iter().count());
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
§

impl<T> FromIterator<(HeaderName, T)> for HeaderMap<T>

§

fn from_iter<I>(iter: I) -> HeaderMap<T>
where I: IntoIterator<Item = (HeaderName, T)>,

Creates a value from an iterator. Read more
source§

impl HeaderMapExt for HeaderMap

source§

fn typed_insert<H>(&mut self, header: H)
where H: Header,

Inserts the typed Header into this HeaderMap.
source§

fn typed_get<H>(&self) -> Option<H>
where H: Header,

Tries to find the header by name, and then decode it into H.
source§

fn typed_try_get<H>(&self) -> Result<Option<H>, Error>
where H: Header,

Tries to find the header by name, and then decode it into H.
§

impl HeaderValueGetter for HeaderMap

§

fn header_str<K>(&self, key: K) -> Result<&str, HeaderValueErr>
where K: AsHeaderName + Copy,

Get a header value as a string.
§

fn header_bytes<K>(&self, key: K) -> Result<&[u8], HeaderValueErr>
where K: AsHeaderName + Copy,

Get a header value as a byte slice.
§

impl<K, T> Index<K> for HeaderMap<T>
where K: AsHeaderName,

§

fn index(&self, index: K) -> &T

§Panics

Using the index operator will cause a panic if the header you’re querying isn’t set.

§

type Output = T

The returned type after indexing.
§

impl<'a, T> IntoIterator for &'a HeaderMap<T>

§

type Item = (&'a HeaderName, &'a T)

The type of the elements being iterated over.
§

type IntoIter = Iter<'a, T>

Which kind of iterator are we turning this into?
§

fn into_iter(self) -> Iter<'a, T>

Creates an iterator from a value. Read more
§

impl<'a, T> IntoIterator for &'a mut HeaderMap<T>

§

type Item = (&'a HeaderName, &'a mut T)

The type of the elements being iterated over.
§

type IntoIter = IterMut<'a, T>

Which kind of iterator are we turning this into?
§

fn into_iter(self) -> IterMut<'a, T>

Creates an iterator from a value. Read more
§

impl<T> IntoIterator for HeaderMap<T>

§

fn into_iter(self) -> IntoIter<T>

Creates a consuming iterator, that is, one that moves keys and values out of the map in arbitrary order. The map cannot be used after calling this.

For each yielded item that has None provided for the HeaderName, then the associated header name is the same as that of the previously yielded item. The first yielded item will have HeaderName set.

§Examples

Basic usage.

let mut map = HeaderMap::new();
map.insert(header::CONTENT_LENGTH, "123".parse().unwrap());
map.insert(header::CONTENT_TYPE, "json".parse().unwrap());

let mut iter = map.into_iter();
assert_eq!(iter.next(), Some((Some(header::CONTENT_LENGTH), "123".parse().unwrap())));
assert_eq!(iter.next(), Some((Some(header::CONTENT_TYPE), "json".parse().unwrap())));
assert!(iter.next().is_none());

Multiple values per key.

let mut map = HeaderMap::new();

map.append(header::CONTENT_LENGTH, "123".parse().unwrap());
map.append(header::CONTENT_LENGTH, "456".parse().unwrap());

map.append(header::CONTENT_TYPE, "json".parse().unwrap());
map.append(header::CONTENT_TYPE, "html".parse().unwrap());
map.append(header::CONTENT_TYPE, "xml".parse().unwrap());

let mut iter = map.into_iter();

assert_eq!(iter.next(), Some((Some(header::CONTENT_LENGTH), "123".parse().unwrap())));
assert_eq!(iter.next(), Some((None, "456".parse().unwrap())));

assert_eq!(iter.next(), Some((Some(header::CONTENT_TYPE), "json".parse().unwrap())));
assert_eq!(iter.next(), Some((None, "html".parse().unwrap())));
assert_eq!(iter.next(), Some((None, "xml".parse().unwrap())));
assert!(iter.next().is_none());
§

type Item = (Option<HeaderName>, T)

The type of the elements being iterated over.
§

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?
§

impl IntoResponse for HeaderMap

§

fn into_response(self) -> Response<Body>

Create a response.
§

impl IntoResponseParts for HeaderMap

§

type Error = Infallible

The type returned in the event of an error. Read more
§

fn into_response_parts( self, res: ResponseParts, ) -> Result<ResponseParts, <HeaderMap as IntoResponseParts>::Error>

Set parts of the response
§

impl<T> PartialEq for HeaderMap<T>
where T: PartialEq,

§

fn eq(&self, other: &HeaderMap<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<'a, K, V, T> TryFrom<&'a HashMap<K, V>> for HeaderMap<T>

Try to convert a HashMap into a HeaderMap.

§Examples

use std::collections::HashMap;
use std::convert::TryInto;
use http::HeaderMap;

let mut map = HashMap::new();
map.insert("X-Custom-Header".to_string(), "my value".to_string());

let headers: HeaderMap = (&map).try_into().expect("valid headers");
assert_eq!(headers["X-Custom-Header"], "my value");
§

type Error = Error

The type returned in the event of a conversion error.
§

fn try_from( c: &'a HashMap<K, V>, ) -> Result<HeaderMap<T>, <HeaderMap<T> as TryFrom<&'a HashMap<K, V>>>::Error>

Performs the conversion.
§

impl<T> Eq for HeaderMap<T>
where T: Eq,

Auto Trait Implementations§

§

impl<T> Freeze for HeaderMap<T>

§

impl<T> RefUnwindSafe for HeaderMap<T>
where T: RefUnwindSafe,

§

impl<T> Send for HeaderMap<T>
where T: Send,

§

impl<T> Sync for HeaderMap<T>
where T: Sync,

§

impl<T> Unpin for HeaderMap<T>
where T: Unpin,

§

impl<T> UnwindSafe for HeaderMap<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

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
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<State, R> IntoEndpointService<State, ()> for R
where State: Clone + Send + Sync + 'static, R: IntoResponse + Clone + Send + Sync + 'static,

§

fn into_endpoint_service( self, ) -> impl Service<State, Request<Body>, Response = Response<Body>, Error = Infallible>

convert the type into a rama_core::Service.
§

impl<T> Pipe for T
where T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<S, P, B, E>(self, other: P) -> And<T, P>
where T: Policy<S, B, E>, P: Policy<S, B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
§

fn or<S, P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<S, B, E>, P: Policy<S, B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T