Skip to main content

RangeFilter

Struct RangeFilter 

Source
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: u64

Which of the five filters this is.

§set_id: u8

The 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

Source

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.

Source

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.

Source

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.

Source

pub fn key(&self) -> RangeFilterKey

This filter’s key for the rule about repeats.

Trait Implementations§

Source§

impl Clone for RangeFilter

Source§

fn clone(&self) -> RangeFilter

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RangeFilter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for RangeFilter

Source§

impl PartialEq for RangeFilter

Source§

fn eq(&self, other: &RangeFilter) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RangeFilter

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.