DtmfTable

Struct DtmfTable 

Source
pub struct DtmfTable;
Expand description

Zero-sized table wrapper for const and runtime utilities.

Implementations§

Source§

impl DtmfTable

Source

pub const LOWS: [u16; 4]

Canonical low-/high-band frequencies (Hz).

Source

pub const HIGHS: [u16; 4]

Source

pub const ALL_KEYS: [DtmfKey; 16]

All keys in keypad order (row-major).

Source

pub const ALL_TONES: [DtmfTone; 16]

All tones as (key, low, high). Kept explicit to stay const.

Source

pub const fn new() -> Self

Constructor (zero-sized instance).

Source

pub const fn lookup_key(key: DtmfKey) -> (u16, u16)

Forward: key → (low, high) (const).

Source

pub const fn from_pair_exact(low: u16, high: u16) -> Option<DtmfKey>

Reverse: exact (low, high) → key (const). Order-sensitive.

Source

pub const fn from_pair_normalised(a: u16, b: u16) -> Option<DtmfKey>

Reverse with normalisation (const): accepts (high, low) as well.

Source

pub fn iter_keys(&self) -> Iter<'static, DtmfKey>

Iterate keys in keypad order (no allocation).

Source

pub fn iter_tones(&self) -> Iter<'static, DtmfTone>

Iterate tones (key + freqs) in keypad order (no allocation).

Source

pub fn from_pair_tol_u32( &self, low: u32, high: u32, tol_hz: u32, ) -> Option<DtmfKey>

Reverse lookup with tolerance in Hz (integer inputs). Matches only when both low and high fall within ±tol_hz of a canonical pair.

Source

pub fn from_pair_tol_f64( &self, low: f64, high: f64, tol_hz: f64, ) -> Option<DtmfKey>

Reverse lookup with tolerance for floating-point estimates (e.g., FFT bin centres).

Source

pub fn nearest_u32(&self, low: u32, high: u32) -> (DtmfKey, u16, u16)

Snap an arbitrary (low, high) estimate to the nearest canonical pair and return (key, snapped_low, snapped_high). Uses absolute distance independently on low and high bands.

Source

pub fn nearest_f64(&self, low: f64, high: f64) -> (DtmfKey, u16, u16)

Floating-point variant of nearest snap.

Trait Implementations§

Source§

impl Default for DtmfTable

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for DtmfTable

Source§

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

Formats the value using the given formatter. Read more

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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.