serialplugin_core/exchange/io.rs
1//! Platform IO hooks for exchange (purge / write).
2
3use crate::error::Error;
4
5/// IO hooks for platform-specific purge / write.
6pub trait ExchangeIo {
7 fn purge_rx(&self) -> Result<(), Error>;
8 fn write_payload(&self, payload: &[u8]) -> Result<(), Error>;
9}
10
11/// Physical port write / purge (alias for unified backend trait surface).
12///
13/// Prefer [`ExchangeIo`]. Kept public for patch-compat with downstream imports;
14/// will be removed in the next major.
15#[deprecated(note = "use ExchangeIo; PortBackend will be removed in 4.0")]
16pub trait PortBackend: ExchangeIo {
17 fn write_physical(&self, path: &str, data: &[u8]) -> Result<(), Error>;
18 fn purge_rx(&self, path: &str) -> Result<(), Error>;
19}