modbus_relay/errors/
rts.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum RtsError {
5    #[error("Failed to set RTS signal: {0}")]
6    SignalError(String),
7
8    #[error("RTS timing error: {0}")]
9    TimingError(String),
10
11    #[error("RTS configuration error: {0}")]
12    ConfigError(String),
13
14    #[error("RTS system error: {0}")]
15    SystemError(#[from] std::io::Error),
16}
17
18impl RtsError {
19    pub fn signal(details: impl Into<String>) -> Self {
20        RtsError::SignalError(details.into())
21    }
22    pub fn timing(details: impl Into<String>) -> Self {
23        RtsError::TimingError(details.into())
24    }
25    pub fn config(details: impl Into<String>) -> Self {
26        RtsError::ConfigError(details.into())
27    }
28}