pub struct Receiver { /* private fields */ }Expand description
Reassembles received events into digits.
The whole job is reporting each keypress exactly once. A tone arrives as many packets and its end arrives three times, so a receiver that reports what it receives reports every digit four or more times — which, for a caller entering a PIN, is a wrong PIN.
Implementations§
Source§impl Receiver
impl Receiver
Sourcepub fn push(&mut self, timestamp: u32, event: &Event) -> Option<Digit>
pub fn push(&mut self, timestamp: u32, event: &Event) -> Option<Digit>
Feed one telephone-event packet.
Returns the digit when the tone ends, and None while it is still sounding or if this
packet is a repeat of an end already reported.
Sourcepub fn in_progress(&self) -> Option<Digit>
pub fn in_progress(&self) -> Option<Digit>
The digit currently sounding, if any.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Receiver
impl RefUnwindSafe for Receiver
impl Send for Receiver
impl Sync for Receiver
impl Unpin for Receiver
impl UnsafeUnpin for Receiver
impl UnwindSafe for Receiver
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