pub enum AvailableHeaders<T> {
    Both {
        protected: T,
        unprotected: T,
    },
    ProtectedOnly(T),
    UnprotectedOnly(T),
}
Expand description

The available message headers.

The message might have a protected header and/or an unprotected header. However, it must always have atleast one of the two.

Variants

Both

Fields

protected: T
unprotected: T

ProtectedOnly(T)

UnprotectedOnly(T)

Implementations

Get the protected header, if it is available.

Get the unprotected header, if it is available.

Get a parameter from either the protected or unprotected header, depending on which are available and which has the parameter.

If a parameter is found in the protected header, the unprotected header is not consulted anymore.

Get a required parameter from either header.

This is almost identical to get, except that this function returns a properly formatter error instead of an empty optional.

Get and deserialize a required parameter from either header.

This function delegates to get_required and deserializes the result into the desired type. Deserialization errors are reported as error::InvalidHeaderParam errors.

Insert a value into either of the available headers.

If the protected header is available, the value is inserted into that one. Otherwise, it is inserted into the unprotected header.

If the value is inserted into the protected header but the key exists in the unprotected header, it is removed from the unprotected header.

Remove a key from all available headers.

This returns the erased value, if any. If the key exists in both headers, the value from the protected header is returned.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
The resulting type after dereferencing.
Dereferences the value.

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.