pub struct VNumber(/* private fields */);Expand description
A JSON number value.
VNumber can represent integers (signed and unsigned) and floating point numbers.
It stores the number in the most appropriate internal format.
Implementations§
Source§impl VNumber
impl VNumber
Sourcepub fn from_f64(v: f64) -> Option<Self>
pub fn from_f64(v: f64) -> Option<Self>
Creates a number from an f64.
Returns None if the value is NaN or infinite.
Sourcepub fn to_f64_lossy(&self) -> f64
pub fn to_f64_lossy(&self) -> f64
Converts to f64, potentially losing precision.
Sourcepub fn is_float(&self) -> bool
pub fn is_float(&self) -> bool
Returns true if this number was created from a floating point value.
Sourcepub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Returns true if this number is an integer (signed or unsigned).
Trait Implementations§
Source§impl Ord for VNumber
impl Ord for VNumber
Source§impl PartialOrd for VNumber
impl PartialOrd for VNumber
impl Eq for VNumber
Auto Trait Implementations§
impl Freeze for VNumber
impl RefUnwindSafe for VNumber
impl Send for VNumber
impl Sync for VNumber
impl Unpin for VNumber
impl UnwindSafe for VNumber
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.