pub enum ConversionError {
UnsupportedCountry,
NotConvertible {
reason: &'static str,
},
Validation(ValidationError),
}Expand description
Error returned when one identifier cannot be converted into another.
A conversion can fail because the source identifier’s country has no
defined target (e.g. extracting a CUSIP from a non-US/CA ISIN), because
the converted value is not itself a valid identifier, or because a
ValidationError surfaced while building the target.
§Examples
use regit_identifiers::errors::{ConversionError, ValidationError};
// A validation error converts into a ConversionError with `?`.
let err: ConversionError = ValidationError::Empty.into();
assert!(matches!(err, ConversionError::Validation(ValidationError::Empty)));Variants§
UnsupportedCountry
The source identifier’s country has no defined target for this conversion (e.g. extracting a CUSIP from a non-US/CA ISIN).
NotConvertible
The conversion produced a value that is not itself valid; reason
names the problem.
Validation(ValidationError)
A validation error surfaced while building the converted identifier.
Trait Implementations§
Source§impl Clone for ConversionError
impl Clone for ConversionError
Source§fn clone(&self) -> ConversionError
fn clone(&self) -> ConversionError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ConversionError
impl Debug for ConversionError
Source§impl Display for ConversionError
impl Display for ConversionError
Source§impl Error for ConversionError
impl Error for ConversionError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
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
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<ValidationError> for ConversionError
impl From<ValidationError> for ConversionError
Source§fn from(e: ValidationError) -> Self
fn from(e: ValidationError) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ConversionError
impl PartialEq for ConversionError
Source§fn eq(&self, other: &ConversionError) -> bool
fn eq(&self, other: &ConversionError) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for ConversionError
impl Eq for ConversionError
impl StructuralPartialEq for ConversionError
Auto Trait Implementations§
impl Freeze for ConversionError
impl RefUnwindSafe for ConversionError
impl Send for ConversionError
impl Sync for ConversionError
impl Unpin for ConversionError
impl UnsafeUnpin for ConversionError
impl UnwindSafe for ConversionError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more