pub struct SubscriptionFilter {
pub filter_type: FilterType,
pub start_location: Option<Location>,
pub end_group: Option<FilterEnd>,
}Expand description
A decoded subscription filter.
The fields after the Filter Type are the ones that type promises, which is why they are optional here and why both directions check them against it: an AbsoluteStart filter puts a Start Location on the wire and no End Group, and the two open-ended types put neither.
Fields§
§filter_type: FilterTypeWhich of the fields below the filter carries, and where the subscription starts when it carries none.
start_location: Option<Location>Present on AbsoluteStart and AbsoluteRange.
end_group: Option<FilterEnd>Present on AbsoluteRange alone.
Implementations§
Source§impl SubscriptionFilter
impl SubscriptionFilter
Sourcepub fn decode(bytes: &[u8]) -> Result<Self, CodecError>
pub fn decode(bytes: &[u8]) -> Result<Self, CodecError>
Decode a filter from a draft-15 or draft-16 parameter value: QUIC variable-length integers, and an End Group written out in full.
Sourcepub fn decode_moqt<P: MoqtProfile>(bytes: &[u8]) -> Result<Self, CodecError>
pub fn decode_moqt<P: MoqtProfile>(bytes: &[u8]) -> Result<Self, CodecError>
Decode a filter from a draft-17, draft-18 or draft-19 parameter value: MoQT variable-length integers, and an End Group Delta.
Sourcepub fn encode(&self, buf: &mut impl BufMut) -> Result<(), CodecError>
pub fn encode(&self, buf: &mut impl BufMut) -> Result<(), CodecError>
Write this filter as a draft-15 or draft-16 parameter value.
Refuses a filter whose fields disagree with its own Filter Type, for the reason the decoder derives presence from that type: a filter with a surplus field is written out and read back short, and one with a missing field is written short and read back out of whatever follows it in the parameter block. Also refuses a value the QUIC integer encoding cannot spell. That encoding stops at 2^62 - 1 and the fields here are 64-bit, so a Start Location group above the limit would otherwise go out as an unrelated number with the length bits folded into it.
Sourcepub fn encode_moqt<P: MoqtProfile>(
&self,
buf: &mut impl BufMut,
) -> Result<(), CodecError>
pub fn encode_moqt<P: MoqtProfile>( &self, buf: &mut impl BufMut, ) -> Result<(), CodecError>
Write this filter as a draft-17, draft-18 or draft-19 parameter value.
The same field checks, and no range check: the MoQT integer encoding reaches the whole 64-bit range, so every value these fields can hold has a representation.
Sourcepub fn parameter(&self) -> Result<KeyValuePair, CodecError>
pub fn parameter(&self) -> Result<KeyValuePair, CodecError>
This filter as the parameter a draft-15 or draft-16 message carries it in.
The reason to have it: from draft-15 a client asking for a range hands its endpoint a parameter list, and the filter inside it is a run of bytes the caller has to assemble. Assembled by hand it is assembled wrong — the fields present depend on the Filter Type, and a frame short by the ones it promised is one the peer reads off the end of.
Sourcepub fn parameter_moqt<P: MoqtProfile>(&self) -> Result<KeyValuePair, CodecError>
pub fn parameter_moqt<P: MoqtProfile>(&self) -> Result<KeyValuePair, CodecError>
This filter as the parameter a draft-17, draft-18 or draft-19 message carries it in.
Sourcepub fn from_parameters(
parameters: &[KeyValuePair],
) -> Option<Result<Self, CodecError>>
pub fn from_parameters( parameters: &[KeyValuePair], ) -> Option<Result<Self, CodecError>>
The filter carried by a message’s parameter list, if it carries one.
None when no filter parameter is present, which every draft from 15 on
defines as an unfiltered subscription rather than as an omission.
Sourcepub fn from_parameters_moqt<P: MoqtProfile>(
parameters: &[KeyValuePair],
) -> Option<Result<Self, CodecError>>
pub fn from_parameters_moqt<P: MoqtProfile>( parameters: &[KeyValuePair], ) -> Option<Result<Self, CodecError>>
The same, reading the MoQT integer encoding of drafts 17 and later.
Sourcepub fn last_group(&self) -> Result<Option<u64>, CodecError>
pub fn last_group(&self) -> Result<Option<u64>, CodecError>
The last Group ID that passes this filter, or None when the filter is
open ended.
Errors when the sum leaves the number space, which is a rule drafts 18 and 19 state and draft-17, which introduced the delta, does not. The caller decides whether its draft answers that with a close; every draft needs the addition itself, because a subscription bounded by a delta is bounded by nothing a comparison can use until the delta is resolved.
Trait Implementations§
Source§impl Clone for SubscriptionFilter
impl Clone for SubscriptionFilter
Source§fn clone(&self) -> SubscriptionFilter
fn clone(&self) -> SubscriptionFilter
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more