pub struct Headers(/* private fields */);Expand description
Application-defined metadata Reliar does not understand: a validating newtype, never a
HashMap alias and never exposed through Deref (ADR 0011). Reserves the entire reliar-
prefix (case-insensitive) so framework metadata is never duplicated here — see
Metadata for the one canonical source of truth (ADR 0004, §14).
Implementations§
Source§impl Headers
impl Headers
Sourcepub const RESERVED_PREFIX: &'static str = "reliar-"
pub const RESERVED_PREFIX: &'static str = "reliar-"
Case-insensitively reserved prefix; Self::insert rejects any key starting with it.
Sourcepub const MAX_KEY_LEN: usize = 128
pub const MAX_KEY_LEN: usize = 128
Maximum key length in bytes.
Sourcepub const MAX_VALUE_LEN: usize = 1024
pub const MAX_VALUE_LEN: usize = 1024
Maximum value length in bytes.
Sourcepub fn insert(
&mut self,
key: impl Into<String>,
value: impl Into<String>,
) -> Result<Option<String>, HeaderError>
pub fn insert( &mut self, key: impl Into<String>, value: impl Into<String>, ) -> Result<Option<String>, HeaderError>
Inserts a header, returning the previous value if the key was already present.
Returns Err — never a silent drop or overwrite — for: the reserved reliar- prefix
(matched case-insensitively, so Reliar-Correlation-Id is rejected too), an empty key, a
key or value containing a control character (including CR/LF — a header-injection surface
once a mapper writes the value onto the wire, same rule as crate::CorrelationId,
crate::EndpointAddress and crate::ContentType), a key over Self::MAX_KEY_LEN,
or a value over Self::MAX_VALUE_LEN. Replacing a key that is already present never
counts against Self::MAX_COUNT; adding a genuinely new key while already at the cap
does.
§Errors
Returns HeaderError for a reserved, empty, control-character-containing, or
over-length key, a control-character-containing or over-length value, or a new key that
would exceed Self::MAX_COUNT.
Trait Implementations§
Source§impl Debug for Headers
Never derived. Header values are application-supplied and may be secrets (SRS §33,
conventions §9): every value prints as <redacted>, keys print verbatim so the shape of a
header set is still debuggable.
impl Debug for Headers
Never derived. Header values are application-supplied and may be secrets (SRS §33,
conventions §9): every value prints as <redacted>, keys print verbatim so the shape of a
header set is still debuggable.