rfid-silion-compat 0.1.0

Async Rust library for Silion RFID readers with serial and Web Serial support
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/// Abstraction over asynchronous byte-oriented transport used by the reader protocol.
#[allow(async_fn_in_trait)]
pub trait ReaderTransport {
    /// Transport-specific error.
    type Error;

    /// Write all bytes to the transport.
    async fn write_all(&mut self, data: &[u8]) -> Result<(), Self::Error>;

    /// Read exactly `buf.len()` bytes from the transport.
    ///
    /// Implementations should await/retry according to their timeout strategy
    /// until the exact byte count is produced or an error is returned.
    async fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Self::Error>;
}