#[non_exhaustive]pub enum ImplicitValue {
Null,
Bool(bool),
U64(u64),
I64(i64),
F64(f64),
}Expand description
The value of an Implicit atom.
These are the types formats infer from text.
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§
Source§impl ImplicitValue
impl ImplicitValue
Sourcepub fn from_atom(atom: &Atom<'_>) -> Option<ImplicitValue>
pub fn from_atom(atom: &Atom<'_>) -> Option<ImplicitValue>
Returns the value for an atom if it’s one of the inferred types.
Sourcepub fn is_same(self, other: ImplicitValue) -> bool
pub fn is_same(self, other: ImplicitValue) -> bool
Returns true if both are the same value.
Unlike ==, floats are compared by their bits: NaN is the same
as NaN and 0.0 is not the same as -0.0. This is useful to
check if text reads back as the same value.
use deser::ImplicitValue;
assert!(
ImplicitValue::F64(f64::NAN).is_same(ImplicitValue::F64(f64::NAN))
);
assert!(!ImplicitValue::F64(0.0).is_same(ImplicitValue::F64(-0.0)));
assert!(!ImplicitValue::U64(1).is_same(ImplicitValue::F64(1.0)));Trait Implementations§
Source§impl Clone for ImplicitValue
impl Clone for ImplicitValue
impl Copy for ImplicitValue
Source§impl Debug for ImplicitValue
impl Debug for ImplicitValue
Source§impl PartialEq for ImplicitValue
impl PartialEq for ImplicitValue
impl StructuralPartialEq for ImplicitValue
Auto Trait Implementations§
impl Freeze for ImplicitValue
impl RefUnwindSafe for ImplicitValue
impl Send for ImplicitValue
impl Sync for ImplicitValue
impl Unpin for ImplicitValue
impl UnsafeUnpin for ImplicitValue
impl UnwindSafe for ImplicitValue
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