ValidationError

Enum ValidationError 

Source
pub enum ValidationError {
Show 20 variants ToneCodeOutOfRange(u8), BandOutOfRange(u8), ModeOutOfRange(u8), MemoryModeOutOfRange(u8), PowerLevelOutOfRange(u8), ToneModeOutOfRange(u8), ShiftOutOfRange(u8), StepSizeOutOfRange(u8), FineStepOutOfRange(u8), DataSpeedOutOfRange(u8), LockoutOutOfRange(u8), DcsCodeInvalid(u8), ChannelNameTooLong { len: usize, }, FrequencyOutOfRange(u32), DigitalSquelchCodeOutOfRange(u8), CrossToneTypeOutOfRange(u8), FlashDigitalSquelchOutOfRange(u8), ChannelOutOfRange { channel: u16, max: u16, }, SettingOutOfRange { name: &'static str, value: u8, detail: &'static str, }, AprsWireOutOfRange { field: &'static str, detail: &'static str, },
}
Expand description

Errors raised when a user-supplied value fails validation.

Variants§

§

ToneCodeOutOfRange(u8)

The CTCSS tone code is outside the valid range 0-49.

Tuple Fields

§0: u8

The invalid tone code.

§

BandOutOfRange(u8)

The band index is outside the valid range 0-13.

Tuple Fields

§0: u8

The invalid band index.

§

ModeOutOfRange(u8)

The operating mode is outside the valid range 0-7.

Tuple Fields

§0: u8

The invalid mode value.

§

MemoryModeOutOfRange(u8)

The memory (flash) mode is outside the valid range 0-7.

Tuple Fields

§0: u8

The invalid memory mode value.

§

PowerLevelOutOfRange(u8)

The power level is outside the valid range 0-3.

Tuple Fields

§0: u8

The invalid power level.

§

ToneModeOutOfRange(u8)

The tone mode is outside the valid range 0-2.

Tuple Fields

§0: u8

The invalid tone mode.

§

ShiftOutOfRange(u8)

The shift direction is outside the valid 4-bit range 0-15.

Tuple Fields

§0: u8

The invalid shift direction.

§

StepSizeOutOfRange(u8)

The step size index is outside the valid range 0-11.

Tuple Fields

§0: u8

The invalid step size.

§

FineStepOutOfRange(u8)

The fine step index is outside the valid range 0-3.

Tuple Fields

§0: u8

The invalid fine step.

§

DataSpeedOutOfRange(u8)

The data speed is outside the valid range 0-1.

Tuple Fields

§0: u8

The invalid data speed.

§

LockoutOutOfRange(u8)

The lockout mode is outside the valid range 0-2.

Tuple Fields

§0: u8

The invalid lockout mode.

§

DcsCodeInvalid(u8)

The DCS code index is not in the valid code table.

Tuple Fields

§0: u8

The invalid DCS code index.

§

ChannelNameTooLong

The channel name exceeds the maximum length of 8 characters.

Fields

§len: usize

The actual length of the channel name.

§

FrequencyOutOfRange(u32)

The frequency is outside the valid range for the band.

Tuple Fields

§0: u32

The invalid frequency in Hz.

§

DigitalSquelchCodeOutOfRange(u8)

The digital squelch code is outside the valid range 0-99.

Tuple Fields

§0: u8

The invalid digital squelch code.

§

CrossToneTypeOutOfRange(u8)

The cross-tone type is outside the valid range 0-3.

Tuple Fields

§0: u8

The invalid cross-tone type value.

§

FlashDigitalSquelchOutOfRange(u8)

The flash digital squelch mode is outside the valid range 0-2.

Tuple Fields

§0: u8

The invalid flash digital squelch value.

§

ChannelOutOfRange

The channel number is outside the valid range.

Fields

§channel: u16

The invalid channel number.

§max: u16

The maximum valid channel number.

§

SettingOutOfRange

A settings/configuration enum value is outside its valid range.

Used for MCP binary settings types (backlight, EQ, language, etc.) where adding a dedicated variant per type would be excessive.

Fields

§name: &'static str

The setting type name (e.g., “backlight control”).

§value: u8

The invalid raw value.

§detail: &'static str

Human-readable valid range description (e.g., “must be 0-2”).

§

AprsWireOutOfRange

A runtime APRS wire-format value failed validation.

Used by the aprs and ax25-codec crates for typed primitives such as Callsign, Latitude, Longitude, Course, and MessageId where the failing value may be too wide to fit in a u8.

Fields

§field: &'static str

Field name, e.g. "Latitude", "Callsign byte".

§detail: &'static str

Human-readable explanation (e.g. "length 7 exceeds max 6").

Trait Implementations§

Source§

impl Debug for ValidationError

Source§

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

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

impl Display for ValidationError

Source§

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

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

impl Error for ValidationError

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<ValidationError> for Error

Source§

fn from(source: ValidationError) -> 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.

§

impl<T> Instrument for T

§

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

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

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

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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