pub trait Json: Clone + Debug {
type Borrowed<'a>: JsonRef<'a, Owned = Self>
where Self: 'a;
// Required methods
fn as_ref(&self) -> Self::Borrowed<'_>;
fn null() -> Self;
fn bool(b: bool) -> Self;
fn from_u64(v: u64) -> Self;
fn from_i64(v: i64) -> Self;
fn from_f64(v: f64) -> Self;
fn from_number(n: Number) -> Self;
fn from_string(s: &str) -> Self;
fn object<'a, I: IntoIterator<Item = (&'a str, Self)>>(i: I) -> Self;
// Provided method
fn borrow<'b, 'a: 'b>(p: Self::Borrowed<'a>) -> Self::Borrowed<'b> { ... }
}
Expand description
A trait for owned JSON values.
Required Associated Types§
Required Methods§
Sourcefn from_number(n: Number) -> Self
fn from_number(n: Number) -> Self
Returns a number value.
Sourcefn from_string(s: &str) -> Self
fn from_string(s: &str) -> Self
Returns a string value.
Sourcefn object<'a, I: IntoIterator<Item = (&'a str, Self)>>(i: I) -> Self
fn object<'a, I: IntoIterator<Item = (&'a str, Self)>>(i: I) -> Self
Returns an object.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.