marlin_binary_transfer/adapters/mod.rs
1//! Optional I/O adapters that wrap the sans-I/O core into convenience APIs.
2//!
3//! The crate's core ([`session`](crate::session), [`file_transfer`](crate::file_transfer),
4//! [`codec`](crate::codec)) does no I/O of its own — callers feed bytes in
5//! and pull events out. These adapter modules lift that core over a real
6//! transport. Each is gated behind its own feature flag so users only pay
7//! for what they use:
8//!
9//! - [`blocking`] (feature `blocking`) — synchronous loop over any
10//! `std::io::Read + std::io::Write` transport.
11//! - [`tokio`] (feature `tokio`) — async loop over any
12//! `tokio::io::AsyncRead + AsyncWrite + Unpin` transport.
13//! - [`serialport`] (feature `serial`) — convenience helpers for opening a
14//! [`serialport::SerialPort`], which already implements `Read + Write`
15//! and so plugs into [`blocking`] directly.
16//!
17//! Custom transports — TCP-to-serial bridges, USB CDC via `rusb`, in-memory
18//! pipes for tests — just need to implement those standard traits.
19//!
20//! Shared option / result / error types live in [`common`].
21//!
22//! [`serialport::SerialPort`]: https://docs.rs/serialport/latest/serialport/trait.SerialPort.html
23
24#[cfg(any(feature = "blocking", feature = "tokio"))]
25pub mod common;
26
27#[cfg(feature = "blocking")]
28#[cfg_attr(docsrs, doc(cfg(feature = "blocking")))]
29pub mod blocking;
30
31#[cfg(feature = "tokio")]
32#[cfg_attr(docsrs, doc(cfg(feature = "tokio")))]
33pub mod tokio;
34
35#[cfg(feature = "serial")]
36#[cfg_attr(docsrs, doc(cfg(feature = "serial")))]
37pub mod serialport;