pub enum Error {
Show 20 variants
DeviceNotFound {
device_id: String,
},
DeviceAlreadyExists {
device_id: String,
},
DataPointNotFound {
device_id: String,
point_id: String,
},
InvalidAddress {
address: u32,
min: u32,
max: u32,
},
InvalidValue {
point_id: String,
reason: String,
},
TypeMismatch {
expected: String,
actual: String,
},
Protocol(String),
Config(String),
Validation {
message: String,
errors: ValidationErrors,
},
Io(Error),
Engine(String),
Lifecycle {
from: DeviceState,
to: DeviceState,
},
CapacityExceeded {
current: usize,
max: usize,
resource: String,
},
Timeout {
duration_ms: u64,
},
NotSupported(String),
Internal(String),
Serialization(String),
Channel(String),
AccessDenied {
point_id: String,
operation: String,
mode: String,
},
OutOfRange {
point_id: String,
value: f64,
min: f64,
max: f64,
},
}Expand description
Simulator error types.
Variants§
DeviceNotFound
Device not found.
DeviceAlreadyExists
Device already exists.
DataPointNotFound
Data point not found.
InvalidAddress
Invalid address.
InvalidValue
Invalid value.
TypeMismatch
Type mismatch.
Protocol(String)
Protocol error.
Config(String)
Configuration error.
Validation
Validation errors (multiple field errors).
Io(Error)
I/O error.
Engine(String)
Engine error.
Lifecycle
Lifecycle error.
CapacityExceeded
Capacity exceeded.
Timeout
Timeout.
NotSupported(String)
Not supported.
Internal(String)
Internal error.
Serialization(String)
Serialization error.
Channel(String)
Channel error.
AccessDenied
Access denied (for access mode violations).
OutOfRange
Range error (for out-of-range values).
Implementations§
Source§impl Error
impl Error
Sourcepub fn device_not_found(device_id: impl Into<String>) -> Error
pub fn device_not_found(device_id: impl Into<String>) -> Error
Create a device not found error.
Sourcepub fn point_not_found(
device_id: impl Into<String>,
point_id: impl Into<String>,
) -> Error
pub fn point_not_found( device_id: impl Into<String>, point_id: impl Into<String>, ) -> Error
Create a data point not found error.
Sourcepub fn capacity_exceeded(
current: usize,
max: usize,
resource: impl Into<String>,
) -> Error
pub fn capacity_exceeded( current: usize, max: usize, resource: impl Into<String>, ) -> Error
Create a capacity exceeded error.
Sourcepub fn access_denied(
point_id: impl Into<String>,
operation: impl Into<String>,
mode: impl Into<String>,
) -> Error
pub fn access_denied( point_id: impl Into<String>, operation: impl Into<String>, mode: impl Into<String>, ) -> Error
Create an access denied error.
Sourcepub fn out_of_range(
point_id: impl Into<String>,
value: f64,
min: f64,
max: f64,
) -> Error
pub fn out_of_range( point_id: impl Into<String>, value: f64, min: f64, max: f64, ) -> Error
Create an out of range error.
Sourcepub fn validation(errors: ValidationErrors) -> Error
pub fn validation(errors: ValidationErrors) -> Error
Create a validation error from a ValidationErrors instance.
Sourcepub fn is_recoverable(&self) -> bool
pub fn is_recoverable(&self) -> bool
Check if this error is recoverable.
Sourcepub fn is_validation(&self) -> bool
pub fn is_validation(&self) -> bool
Check if this is a validation error.
Sourcepub fn is_not_found(&self) -> bool
pub fn is_not_found(&self) -> bool
Check if this is a not found error.
Sourcepub fn severity(&self) -> ErrorSeverity
pub fn severity(&self) -> ErrorSeverity
Get error severity.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<ModbusError> for Error
impl From<ModbusError> for Error
Source§fn from(err: ModbusError) -> Error
fn from(err: ModbusError) -> Error
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl !UnwindSafe for Error
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more