Skip to main content

EncodeSink

Trait EncodeSink 

Source
pub trait EncodeSink: Sealed {
    // Required method
    fn write<V: HeaderValue>(
        &mut self,
        key: &'static str,
        value: &V,
        context: HeaderFieldContext,
    ) -> Result<(), ProtocolContractViolation>;
}
Expand description

A statically dispatched destination for typed header fields.

This trait is sealed. Protocol-owned implementations preserve identical field semantics while allowing LLVM to specialize map and future binary writes without a trait object in the per-field path.

Required Methods§

Source

fn write<V: HeaderValue>( &mut self, key: &'static str, value: &V, context: HeaderFieldContext, ) -> Result<(), ProtocolContractViolation>

Writes one canonical field.

The caller is responsible for header validation and Java range checks before this method. Sinks must not duplicate those policy decisions.

§Errors

Returns a classified codec error when the destination wire format cannot represent the key or value. Map writes are currently infallible.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§