#[non_exhaustive]pub enum Number {
I8(i8),
I16(i16),
I32(i32),
I64(i64),
U8(u8),
U16(u16),
U32(u32),
U64(u64),
F32(F32),
F64(F64),
}
Expand description
A wrapper for any numeric primitive type in Rust.
Some varints of the Number
enum are enabled by features:
Number::I128
andNumber::U128
by theinteger128
feature
To ensure that feature unification does not break match
ing over Number
,
the Number
enum is non-exhaustive.
Exhaustively matching on Number
in tests
If you want to ensure that you exhaustively handle every variant, you can
match on the hidden Number::__NonExhaustive
variant.
Matching on this variant means that your code may break when RON is
upgraded or when feature unification enables further variants in the
Number
enum than your code expects.
It is your responsibility to only ever match on Number::__NonExhaustive
inside tests, e.g. by using #[cfg(test)]
on the particular match arm, to
ensure that only your tests break (e.g. in CI) when your code is not
exhaustively matching on every variant, e.g. after a version upgrade or
feature unification.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Implementations§
Trait Implementations§
Source§impl Ord for Number
impl Ord for Number
Source§impl PartialOrd for Number
impl PartialOrd for Number
impl Copy for Number
impl Eq for Number
impl StructuralPartialEq for Number
Auto Trait Implementations§
impl Freeze for Number
impl RefUnwindSafe for Number
impl Send for Number
impl Sync for Number
impl Unpin for Number
impl UnwindSafe for Number
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