PriceLevelError

Enum PriceLevelError 

Source
pub enum PriceLevelError {
    ParseError {
        message: String,
    },
    InvalidFormat,
    UnknownOrderType(String),
    MissingField(String),
    InvalidFieldValue {
        field: String,
        value: String,
    },
    InvalidOperation {
        message: String,
    },
    SerializationError {
        message: String,
    },
    DeserializationError {
        message: String,
    },
    ChecksumMismatch {
        expected: String,
        actual: String,
    },
}
Expand description

Represents errors that can occur when processing price levels in trading operations.

This enum encapsulates various error conditions that might arise during order book management, price validation, and other trading-related operations.

§Examples

use pricelevel::PriceLevelError;

// Creating a parse error
let error = PriceLevelError::ParseError {
    message: "Failed to parse price: invalid decimal format".to_string()
};

// Creating a missing field error
let missing_field_error = PriceLevelError::MissingField("price".to_string());

Variants§

§

ParseError

Error that occurs when parsing fails with a specific message.

This variant is used when string conversion or data parsing operations fail.

Fields

§message: String

Descriptive message explaining the parsing failure

§

InvalidFormat

Error indicating that the input is in an invalid format.

This is a general error for when the input data doesn’t conform to expected patterns but doesn’t fit into more specific error categories.

§

UnknownOrderType(String)

Error indicating an unrecognized order type was provided.

Used when the system encounters an order type string that isn’t in the supported set. The string parameter contains the unrecognized order type.

§

MissingField(String)

Error indicating a required field is missing.

Used when a mandatory field is absent in the input data. The string parameter specifies which field is missing.

§

InvalidFieldValue

Error indicating a field has an invalid value.

This error occurs when a field’s value is present but doesn’t meet validation criteria.

Fields

§field: String

The name of the field with the invalid value

§value: String

The invalid value as a string representation

§

InvalidOperation

Error indicating an operation cannot be performed for the specified reason.

Used when an action is prevented due to business rules or system constraints.

Fields

§message: String

Explanation of why the operation is invalid

§

SerializationError

Error raised when serialization of internal data structures fails.

Fields

§message: String

Descriptive message with the serialization failure details

§

DeserializationError

Error raised when deserialization of external data into internal structures fails.

Fields

§message: String

Descriptive message with the deserialization failure details

§

ChecksumMismatch

Error raised when a checksum validation fails while restoring a snapshot.

Fields

§expected: String

The checksum that was expected according to the serialized payload

§actual: String

The checksum that was computed from the provided payload

Trait Implementations§

Source§

impl Debug for PriceLevelError

Source§

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

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

impl Display for PriceLevelError

Source§

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

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

impl Error for PriceLevelError

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

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more