pub trait Readers: Send + Sync {
// Required methods
fn present(&self) -> Result<Vec<String>, CardError>;
fn visit(
&self,
visit: &mut dyn FnMut(&mut dyn Card) -> Visit,
) -> Result<Visited, CardError>;
// Provided methods
fn wait_change(&self, timeout: Duration) { ... }
fn taps(&self) -> bool { ... }
fn want(&self, _wanted: bool) { ... }
fn by_cable(&self) -> bool { ... }
fn reach_note(&self) -> Option<CardError> { ... }
}Expand description
Where Sioul finds security keys: the system’s smart card service on a computer, a phone’s NFC or USB, a software stand-in in tests.
Required Methods§
Provided Methods§
Sourcefn wait_change(&self, timeout: Duration)
fn wait_change(&self, timeout: Duration)
Waits for the readers to change, timeout at most: a computer looks
again after it; a phone wakes as soon as a key is held to it.
Sourcefn taps(&self) -> bool
fn taps(&self) -> bool
Whether a key is used in one tap (a phone, over NFC): its PIN asked first, from what Sioul knows of it, then the key read, given its PIN and used while it is held, never read on its own beforehand.
Sourcefn want(&self, _wanted: bool)
fn want(&self, _wanted: bool)
A key is wanted now, or no longer: a phone reads keys (NFC’s reader mode, ahead of other apps) only while Sioul asks for one, in front.
Sourcefn by_cable(&self) -> bool
fn by_cable(&self) -> bool
Whether the key in reach now, or the last one used, came by cable (a phone’s USB-C port): its touch is asked as on a computer, and it is unplugged rather than moved away. A computer’s readers say no: their words are the computer’s.
Sourcefn reach_note(&self) -> Option<CardError>
fn reach_note(&self) -> Option<CardError>
How keys can come now, when one way is missing: a phone without NFC
(NoNfc) or with NFC off (NfcOff) still takes a key plugged in.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".