Skip to main content

VouchedError

Trait VouchedError 

Source
pub trait VouchedError:
    StdError
    + Send
    + Sync
    + 'static {
    // Provided methods
    fn as_too_short(&self) -> Option<&TooShortError> { ... }
    fn as_too_long(&self) -> Option<&TooLongError> { ... }
    fn as_out_of_range_numeric(&self) -> Option<&OutOfRangeNumericError> { ... }
    fn as_invalid_char(&self) -> Option<&InvalidCharError> { ... }
}
Expand description

Common interface for generated Vouched errors.

Error types generated by the Vouched derive macro implement this trait. The as_* methods provide type-safe access to specific validation errors.

Provided Methods§

Source

fn as_too_short(&self) -> Option<&TooShortError>

Returns the underlying too-short error when this is that variant.

Source

fn as_too_long(&self) -> Option<&TooLongError>

Returns the underlying too-long error when this is that variant.

Source

fn as_out_of_range_numeric(&self) -> Option<&OutOfRangeNumericError>

Returns the underlying numeric out-of-range error when this is that variant.

Source

fn as_invalid_char(&self) -> Option<&InvalidCharError>

Returns the underlying invalid-character error when this is that variant.

Trait Implementations§

Source§

impl AsRef<dyn VouchedError> for Error

Available on crate feature alloc only.
Source§

fn as_ref(&self) -> &(dyn VouchedError + 'static)

Converts this type into a shared reference of the (usually inferred) input type.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§