pub trait JsonNumber {
// Required methods
fn as_u64(&self) -> Option<u64>;
fn as_i64(&self) -> Option<i64>;
fn as_f64(&self) -> Option<f64>;
fn as_str(&self) -> Cow<'_, str>;
fn to_number(&self) -> Cow<'_, Number>;
// Provided method
fn is_integer(&self) -> bool { ... }
}Expand description
A JSON number, readable without constructing a ::serde_json::Number.
Required Methods§
fn as_u64(&self) -> Option<u64>
fn as_i64(&self) -> Option<i64>
fn as_f64(&self) -> Option<f64>
Provided Methods§
Sourcefn is_integer(&self) -> bool
fn is_integer(&self) -> bool
type: integer checks call this per number: override it where the default’s
JsonNumber::to_number round-trip is not free (e.g. decimal representations).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".