pub struct Number(/* private fields */);Expand description
A number deserialized from JSON.
Implementations§
Source§impl Number
impl Number
Sourcepub fn i64(&self) -> Option<i64>
pub fn i64(&self) -> Option<i64>
Get the current number as an i64.
This uses the definition of a number defined in RFC-8259, then constrains it to having no
fractional part once normalized. It’s yielded if it’s representable within an i64. Note
normalization will truncate “10.0”, so this is lossy to if the original encoding had a
fractional part.
This is exact. It does not go through f64 and does not experience its approximations.
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