pub struct SubscriptionHeader {
pub endpoint: String,
pub filter: String,
pub max_age_ms: Option<u64>,
pub max_layer: Option<u8>,
}Expand description
SUBSCRIBE and UNSUBSCRIBE header.
Both frames carry the same two keys: the publisher path to (un)subscribe on
and the topic filter. The filter is a segmented pattern, not a byte prefix
(filter): the empty filter matches every topic, * matches one whole
segment and a trailing # matches zero or more.
Fields§
§endpoint: StringPublisher endpoint path.
filter: StringTopic filter; the empty string matches everything. A decoded header’s
filter has passed filter::validate.
max_age_ms: Option<u64>The dish’s latency budget in milliseconds (key 2), meaningful on a
RADIO path only
(decisions/0034
§4.6). Encoded only when present.
max_layer: Option<u8>The highest layer the dish wants (key 3), 0..=15, meaningful on a
RADIO path only; absent means no cap
(decisions/0037
§4.3). Encoded only when present.
Implementations§
Source§impl SubscriptionHeader
impl SubscriptionHeader
Sourcepub fn new(
endpoint: impl Into<String>,
filter: impl Into<String>,
) -> SubscriptionHeader
pub fn new( endpoint: impl Into<String>, filter: impl Into<String>, ) -> SubscriptionHeader
A header for endpoint and filter.
Sourcepub fn encode_into(&self, out: &mut Vec<u8>)
pub fn encode_into(&self, out: &mut Vec<u8>)
Appends the encoded header to out, for a send path that reuses a
buffer (B-250). The canonical form has one implementation and this is
it; Self::encode is a wrapper.
Sourcepub fn decode(bytes: &[u8]) -> Result<SubscriptionHeader, HeaderError>
pub fn decode(bytes: &[u8]) -> Result<SubscriptionHeader, HeaderError>
Decodes the header.