Skip to main content

SelectParam

Struct SelectParam 

Source
pub struct SelectParam {
    pub decimate: u32,
    pub channels: Vec<u16>,
}
Expand description

The parameter of a select/1 offer and answer (docs/roadmap.md, step 6).

Wire encoding (lowercase hex, no separator):

  • 8 hex digits: decimate as u32 big-endian (>= 1; 1 = full rate)
  • 4 hex digits: channels.len() as u16 big-endian (0 = all channels)
  • 4 * channels.len() hex digits: each 0-based channel index as u16 big-endian

Fields§

§decimate: u32

Integer rate decimation factor (1 keeps the full rate, 16 reduces 4000 Hz to 250 Hz).

§channels: Vec<u16>

Ordered 0-based channel indices to keep. Empty means every channel.

Implementations§

Source§

impl SelectParam

Source

pub fn channels(channels: Vec<u16>) -> Self

Select a subset of channels at full rate.

Source

pub fn decimate(factor: u32) -> Self

Decimate all channels by factor (clamped to >= 1).

Source

pub fn is_active(&self) -> bool

True when this parameter actually narrows channels or reduces rate.

Source

pub fn output_channels(&self, source_channels: usize) -> usize

Effective channel count for a source stream with source_channels.

Source

pub fn output_srate(&self, source_srate: f64) -> f64

Effective sample rate for a source stream with source_srate.

Source

pub fn parse(param: &str) -> Option<SelectParam>

Read a select/1 parameter from its lowercase hexadecimal string.

Source

pub fn to_param(&self) -> String

Encode this parameter as lowercase hexadecimal.

Source

pub fn token(&self) -> Token

Build the select/1=<hex> wire token.

Trait Implementations§

Source§

impl Clone for SelectParam

Source§

fn clone(&self) -> Self

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 SelectParam

Source§

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

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

impl Eq for SelectParam

Source§

impl PartialEq for SelectParam

Source§

fn eq(&self, other: &Self) -> 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 SelectParam

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, !>

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.