pub struct Headers { /* private fields */ }
Expand description

Trillium’s header map type

Implementations

Construct a new Headers, expecting to see at least this many known headers.

Construct a new headers with a default capacity of 15 known headers

Extend the capacity of the known headers map by this many

Return an iterator over borrowed header names and header values. First yields the known headers and then the unknown headers, if any.

add the header value or header values into this header map. If there is already a header with the same name, the new values will be added to the existing ones. To replace any existing values, use Headers::insert

Add a header value or header values into this header map. If a header already exists with the same name, it will be replaced. To combine, see Headers::append

Add a header value or header values into this header map if and only if there is not already a header with the same name.

Retrieves a &str header value if there is at least one header in the map with this name. If there are several headers with the same name, this follows the behavior defined at HeaderValues::one. Returns None if there is no header with the provided header name.

Retrieves a singular header value from this header map. If there are several headers with the same name, this follows the behavior defined at HeaderValues::one. Returns None if there is no header with the provided header name

Takes all headers with the provided header name out of this header map and returns them. Returns None if the header did not have an entry in this map.

Retrieves a reference to all header values with the provided header name. If you expect there to be only one value, use Headers::get.

Predicate function to check whether this header map contains the provided header name. If you are using this to conditionally insert a value, consider using Headers::try_insert instead.

Convenience function to check whether the value contained in this header map for the provided name is ascii-case-insensitively equal to the provided comparison &str. Returns false if there is no value for the name

Convenience function to check whether the value contained in this header map for the provided name. Prefer testing against a lower case string, as the implementation currently has to allocate if .

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

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

🔬 This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

🔬 This is a nightly-only experimental API. (extend_one)

Reserves capacity in a collection for the given number of additional elements. Read more

Creates a value from an iterator. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.