Skip to main content

HeaderSource

Trait HeaderSource 

Source
pub trait HeaderSource {
    type Position;

    // Required method
    fn into_position(self) -> Self::Position;
}
Expand description

What may fill the headers position of a publish: a borrowed contract value, or an already-built HeaderMap.

The two differ in what they say about the message, not in how they are written: a borrowed value is the message’s declared contract, serialized one entry per field, while a map is the transport level and stands for no contract at all (a message type declaring one still demands its value). Which of the two a call site passed rides in the type, so with_headers is one method and the contract check stays a compile error either way.

You never implement it: HeaderMap and &H of every serializable H already do.

Required Associated Types§

Source

type Position

The headers position this source resolves to: TypedHeaders or MapHeaders.

Required Methods§

Source

fn into_position(self) -> Self::Position

Moves the source into its position.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'a, H: ?Sized> HeaderSource for &'a H

Implementors§