pub struct Number(/* private fields */);Expand description
Represents a JSON number.
Implementations§
Source§impl Number
impl Number
Sourcepub fn from_f64(val: f64) -> Option<Self>
pub fn from_f64(val: f64) -> Option<Self>
Creates JSON number from f64.
Returns None if the number is infinite or NaN.
Sourcepub fn as_u64(&self) -> Option<u64>
pub fn as_u64(&self) -> Option<u64>
Returns the number as u64, or None if it is not a positive integer.
Sourcepub fn as_i64(&self) -> Option<i64>
pub fn as_i64(&self) -> Option<i64>
Returns the number as i64, or None if it is not a negative integer.
Sourcepub fn is_u64(&self) -> bool
pub fn is_u64(&self) -> bool
Returns true if the number is an unsigned integer or a positive integer.
Trait Implementations§
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