msrt_uart/tokio_error.rs
1//! Error types for Tokio UART frontend.
2
3use std::io;
4
5/// Result alias for Tokio UART frontend operations.
6pub type TokioResult<T> = core::result::Result<T, TokioError>;
7
8/// Error returned by Tokio UART frontend.
9#[derive(Debug)]
10pub enum TokioError {
11 /// Underlying async IO failed.
12 Io(io::Error),
13 /// MSRT protocol processing failed.
14 Protocol(msrt::error::Error),
15}
16
17impl From<io::Error> for TokioError {
18 fn from(error: io::Error) -> Self {
19 Self::Io(error)
20 }
21}
22
23impl From<msrt::error::Error> for TokioError {
24 fn from(error: msrt::error::Error) -> Self {
25 Self::Protocol(error)
26 }
27}