pub struct RangeFilter {
pub parameter_type: u64,
pub set_id: u8,
pub property_type: Option<u64>,
pub ranges: Vec<FilterRange>,
}Expand description
A decoded Range Filter parameter value.
Fields§
§parameter_type: u64Which of the five filters this is.
set_id: u8The set this filter belongs to. “All filter parameters with the same SetID value are combined using logical ‘AND’ operations, then all the resulting sets are combined using logical ‘OR’ operations.” So the SetID is not decoration: two filters under one SetID both have to pass, and two filters under different SetIDs each pass on their own.
property_type: Option<u64>The property this filter is about, on the two property filters.
None on SUBGROUP_FILTER, OBJECTID_FILTER and PRIORITY_FILTER, whose
subject is fixed by the parameter type.
ranges: Vec<FilterRange>The ranges, with every delta resolved to an absolute value.
Implementations§
Source§impl RangeFilter
impl RangeFilter
Sourcepub fn decode_moqt<P: MoqtProfile>(
parameter_type: u64,
bytes: &[u8],
) -> Result<Self, RangeFilterError>
pub fn decode_moqt<P: MoqtProfile>( parameter_type: u64, bytes: &[u8], ) -> Result<Self, RangeFilterError>
Read a Range Filter from the bytes of its parameter value.
bytes is the value after the Key-Value-Pair’s Length has been consumed,
which is what a decoded parameter holds — the Length in Section 5.1.3’s
figure is that same prefix and not a second one inside the value.
An empty value decodes to a filter with no ranges rather than an error:
“In REQUEST_UPDATE, Length can be 0 to remove a filter parameter or
non-zero to replace that entire filter parameter including all sets and
Property Types.” The three-field filters can express that in zero bytes
only if the SetID is also absent, so an empty value is taken as the
removal and anything shorter than its own prefix is not.
Sourcepub fn encode_moqt<P: MoqtProfile>(
&self,
buf: &mut impl BufMut,
) -> Result<(), RangeFilterError>
pub fn encode_moqt<P: MoqtProfile>( &self, buf: &mut impl BufMut, ) -> Result<(), RangeFilterError>
Write this filter as a parameter value.
Refuses what the decoder refuses, and one thing more: a range whose End is below its Start, and an unbounded range anywhere but last. Both encode perfectly well and neither reads back as what was written — a backwards End wraps its delta into a nine-byte integer that resolves to an unrelated value, and an unbounded range in the middle silently pairs its successor’s Start as its own End.
Sourcepub fn passes(&self, value: u64) -> bool
pub fn passes(&self, value: u64) -> bool
Whether value passes this filter.
A filter with no ranges passes nothing, which is what a filter that lists no acceptable values says. The removal form of a REQUEST_UPDATE is the same shape on the wire and is not the same statement, so a caller acting on an update reads the removal from the parameter’s zero Length before it asks anything to pass.
Sourcepub fn key(&self) -> RangeFilterKey
pub fn key(&self) -> RangeFilterKey
This filter’s key for the rule about repeats.
Trait Implementations§
Source§impl Clone for RangeFilter
impl Clone for RangeFilter
Source§fn clone(&self) -> RangeFilter
fn clone(&self) -> RangeFilter
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more