Skip to main content

MbusError

Enum MbusError 

Source
pub enum MbusError {
Show 40 variants ParseError, BasicParseError, Timeout, ModbusException(u8), IoError, Unexpected, ConnectionLost, UnsupportedFunction(u8), ReservedSubFunction(u16), InvalidPduLength, InvalidAduLength, ConnectionFailed, ConnectionClosed, BufferTooSmall, BufferLenMissmatch, SendFailed, InvalidAddress, InvalidOffset, TooManyRequests, InvalidFunctionCode, NoRetriesLeft, TooManyFileReadSubRequests, FileReadPduOverflow, UnexpectedResponse, InvalidTransport, InvalidSlaveAddress, ChecksumError, InvalidConfiguration, InvalidNumOfExpectedRsps, InvalidDataLen, InvalidQuantity, InvalidValue, InvalidAndMask, InvalidOrMask, InvalidByteCount, InvalidDeviceIdentification, InvalidDeviceIdCode, InvalidMeiType, InvalidBroadcastAddress, BroadcastNotAllowed,
}
Expand description

Represents a Modbus error.

Variants§

§

ParseError

An error occurred while parsing the Modbus ADU.

§

BasicParseError

This is used for receieved frame is fundamentally malformed

§

Timeout

The transaction timed out waiting for a response.

§

ModbusException(u8)

The server responded with a Modbus exception code.

§

IoError

An I/O error occurred during TCP communication.

§

Unexpected

An unexpected error occurred.

§

ConnectionLost

The connection was lost during an active transaction.

§

UnsupportedFunction(u8)

The function code is not supported

§

ReservedSubFunction(u16)

The sub-function code is not available

§

InvalidPduLength

The PDU length is invalid

§

InvalidAduLength

The ADU length is invalid

§

ConnectionFailed

Connection failed

§

ConnectionClosed

Connection closed

§

BufferTooSmall

The data was too large for the buffer

§

BufferLenMissmatch

Buffer length is not matching

§

SendFailed

Failed to send data

§

InvalidAddress

Invalid address

§

InvalidOffset

Invalid offset

§

TooManyRequests

Too many requests in flight, expected responses buffer is full

§

InvalidFunctionCode

Invalid function code

§

NoRetriesLeft

No retries left for the transaction

§

TooManyFileReadSubRequests

Too many sub-requests in a PDU, Max allowed is 35

§

FileReadPduOverflow

File read PDU overflow, total length of file read sub-requests exceeds maximum allowed bytes per PDU

§

UnexpectedResponse

An unexpected response was received that does not match the expected response type for the transaction.

§

InvalidTransport

The transport is invalid for the requested operation

§

InvalidSlaveAddress

Invalid slave address

§

ChecksumError

Checksum error

§

InvalidConfiguration

Invalid configuration

§

InvalidNumOfExpectedRsps

Invalid number of expected responses.

For Modbus Serial transports, only one request may be in flight at a time, so the expected-response queue size must be exactly 1.

§

InvalidDataLen

Invalid data length

§

InvalidQuantity

Invalid Quantity

§

InvalidValue

Invalid Value

§

InvalidAndMask

Invalid Masking value

§

InvalidOrMask

Invalid Masking value

§

InvalidByteCount

Invalid byte count

§

InvalidDeviceIdentification

Invalid device identification

§

InvalidDeviceIdCode

Invalid device id code

§

InvalidMeiType

Invalid MEI type

§

InvalidBroadcastAddress

Invalid broadcast address (0): Broadcast must be created explicitly. Use UnitIdOrSlaveAddr::new_broadcast_address() to signal broadcast intent.

§

BroadcastNotAllowed

Broadcast not allowed.

Note: This variant name contains a historical typo and is kept for compatibility with existing code.

Implementations§

Source§

impl MbusError

Source

pub const fn broadcast_not_allowed() -> Self

Returns the canonical “broadcast not allowed” error.

This helper exists to provide a correctly spelled API path while preserving the legacy enum variant name for compatibility.

Trait Implementations§

Source§

impl Clone for MbusError

Source§

fn clone(&self) -> MbusError

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MbusError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for MbusError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for MbusError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<TransportError> for MbusError

Source§

fn from(err: TransportError) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for MbusError

Source§

fn eq(&self, other: &MbusError) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for MbusError

Source§

impl Eq for MbusError

Source§

impl StructuralPartialEq for MbusError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.