PrimitiveError

Trait PrimitiveError 

Source
pub trait PrimitiveError:
    'static
    + Sealed
    + Clone
    + PartialEq
    + Error
    + Send
    + Sync { }
Expand description

Trait for errors that may be returned in numeric conversions.

In particular, this is used as a bound for the associated error types of FromStr, TryFrom, and TryInto in the supertraits of other primitive traits in this crate. This is not exhaustive of everything these errors have in common, but it’s sufficient for:

  • Result::clone()
  • Result::eq() (i.e. PartialEq)
  • Result::unwrap() (i.e. Debug)
  • From<E> for Box<dyn Error + 'a>
  • From<E> for Box<dyn Error + Send + Sync + 'a>

This trait is sealed with a private trait to prevent downstream implementations, so we may continue to expand along with the standard library without worrying about breaking changes for implementors.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl PrimitiveError for Infallible

Source§

impl PrimitiveError for ParseFloatError

Source§

impl PrimitiveError for ParseIntError

Source§

impl PrimitiveError for TryFromIntError

Implementors§