pub struct PcscMonitor { /* private fields */ }Implementations§
Source§impl PcscMonitor
impl PcscMonitor
Sourcepub fn instance() -> MutexGuard<'static, PcscMonitor>
pub fn instance() -> MutexGuard<'static, PcscMonitor>
Gets a global instance of the PcscMonitor to register callbacks.
This method returns a locked [MutexGuard] to the global monitor instance.
Use this to attach listeners and start monitoring.
§Example
let mut monitor = pcsc_mon::PcscMonitor::instance();
monitor.on_reader_added(|reader| {
println!("Reader added: {}", reader);
});
monitor.start();Sourcepub fn on_reader_added<F>(&mut self, f: F)
pub fn on_reader_added<F>(&mut self, f: F)
Registers a callback for reader addition events.
The callback is called with the name of the reader when a new reader is connected.
Sourcepub fn on_reader_removed<F>(&mut self, f: F)
pub fn on_reader_removed<F>(&mut self, f: F)
Registers a callback for reader removal events.
The callback is called with the name of the reader when a reader is disconnected.
Note: Internally sets the reader state to State::IGNORE. When the same
reader is reconnected, a card must be inserted and removed again to re-trigger
on_card_inserted.
Sourcepub fn on_card_inserted<F>(&mut self, f: F)
pub fn on_card_inserted<F>(&mut self, f: F)
Sourcepub fn on_card_removed<F>(&mut self, f: F)
pub fn on_card_removed<F>(&mut self, f: F)
Registers a callback for card removal events.
The callback is called with the name of the reader when the card is removed.
Auto Trait Implementations§
impl !Freeze for PcscMonitor
impl !RefUnwindSafe for PcscMonitor
impl Send for PcscMonitor
impl Sync for PcscMonitor
impl Unpin for PcscMonitor
impl UnsafeUnpin for PcscMonitor
impl !UnwindSafe for PcscMonitor
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