pub enum DtmfDigit {
Show 16 variants
D0,
D1,
D2,
D3,
D4,
D5,
D6,
D7,
D8,
D9,
Star,
Pound,
A,
B,
C,
D,
}Expand description
A single DTMF digit per RFC 4733 §2.5.2.1 event codes 0-15.
D0-D9, Star, Pound, A-D. The letter variants are vestigial
(US AUTOVON keypad) and almost never appear in practice; consumers
should typically only expose the digits and * # in their UI.
Variants§
Implementations§
Source§impl DtmfDigit
impl DtmfDigit
Sourcepub fn from_char(c: char) -> Option<Self>
pub fn from_char(c: char) -> Option<Self>
Parse a digit from one of 0-9, *, #, or A-D
(case-insensitive for the letters). Returns None for anything
else, including whitespace.
Sourcepub fn as_char(self) -> char
pub fn as_char(self) -> char
The canonical character for this digit, e.g. 5 for D5,
* for Star, A (uppercase) for A.
Sourcepub fn from_event_code(code: u8) -> Option<Self>
pub fn from_event_code(code: u8) -> Option<Self>
Map an RFC 4733 §2.5.2.1 event code back to a digit — the
inverse of DtmfDigit::event_code. Returns None for codes
≥ 16 (flash-hook and the other non-DTMF telephone events).
Sourcepub fn event_code(self) -> u8
pub fn event_code(self) -> u8
The RFC 4733 §2.5.2.1 event code (0-15) for this digit.
Trait Implementations§
impl Copy for DtmfDigit
impl Eq for DtmfDigit
impl StructuralPartialEq for DtmfDigit
Auto Trait Implementations§
impl Freeze for DtmfDigit
impl RefUnwindSafe for DtmfDigit
impl Send for DtmfDigit
impl Sync for DtmfDigit
impl Unpin for DtmfDigit
impl UnsafeUnpin for DtmfDigit
impl UnwindSafe for DtmfDigit
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.