mikrotik_rs::protocol::error

Enum ProtocolError

Source
pub enum ProtocolError {
    Sentence(SentenceError),
    Incomplete(MissingWord),
    WordSequence {
        word: WordType,
        expected: Vec<WordType>,
    },
    TrapCategory(TrapCategoryError),
}
Expand description

Possible errors while parsing a [CommandResponse] from a [Sentence].

This enum provides more detailed information about issues that can arise while parsing command responses, such as missing tags, missing attributes, or unexpected attributes.

Variants§

§

Sentence(SentenceError)

Error related to the [Sentence].

This variant encapsulates errors that occur due to issues in parsing a [Sentence] from bytes.

§

Incomplete(MissingWord)

Error related to the length of a response.

Indicates that the response is missing some words to be a valid response.

§

WordSequence

The received sequence of words is not a valid response.

Fields

§word: WordType

The unexpected WordType that was encountered.

§expected: Vec<WordType>

The expected WordType.

§

TrapCategory(TrapCategoryError)

Error related to identifying or parsing a [Trap] response category.

Indicates that an invalid category was encountered during parsing, which likely points to either a malformed response.

Trait Implementations§

Source§

impl Debug for ProtocolError

Source§

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

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

impl From<MissingWord> for ProtocolError

Source§

fn from(e: MissingWord) -> Self

Converts to this type from the input type.
Source§

impl From<SentenceError> for ProtocolError

Source§

fn from(e: SentenceError) -> Self

Converts to this type from the input type.
Source§

impl From<TrapCategoryError> for ProtocolError

Source§

fn from(e: TrapCategoryError) -> Self

Converts to this type from the input type.

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> 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, 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.