pub trait SemaStream: Debug {
// Required methods
fn read(&self, buf: &mut [u8]) -> Result<usize, SemaError>;
fn write(&self, data: &[u8]) -> Result<usize, SemaError>;
fn stream_type(&self) -> &'static str;
fn as_any(&self) -> &dyn Any;
// Provided methods
fn available(&self) -> Result<bool, SemaError> { ... }
fn flush(&self) -> Result<(), SemaError> { ... }
fn close(&self) -> Result<(), SemaError> { ... }
fn is_readable(&self) -> bool { ... }
fn is_writable(&self) -> bool { ... }
}Expand description
Trait for stream implementations (files, buffers, serial ports, etc.).
All methods take &self — interior mutability is handled by the implementation.