mmdvm/transport.rs
1//! Transport abstraction for the MMDVM async shell.
2//!
3//! Consumers provide any type that implements both [`AsyncRead`] and
4//! [`AsyncWrite`] — the shell takes ownership and drives it from the
5//! internal modem loop. Typical concrete types:
6//!
7//! - `tokio::io::DuplexStream` for unit tests
8//! - `tokio_serial::SerialStream` for USB-CDC (Kenwood TH-D75)
9//! - `thd75::transport::EitherTransport` for the USB/Bluetooth SPP
10//! auto-selection used by the TH-D75 crates
11
12use tokio::io::{AsyncRead, AsyncWrite};
13
14/// Async bidirectional byte stream for talking to an MMDVM modem.
15///
16/// Blanket-implemented for any type that is both [`AsyncRead`] +
17/// [`AsyncWrite`] + [`Send`] + [`Unpin`]. See [`mmdvm_core`] for the
18/// wire-format specifics the bytes on this stream must follow.
19///
20/// [`mmdvm_core`]: crate::core
21pub trait Transport: AsyncRead + AsyncWrite + Send + Unpin {}
22
23impl<T: AsyncRead + AsyncWrite + Send + Unpin> Transport for T {}