pub trait ObjectRef<'a>: Copy {
type JsonRef: JsonRef<'a>;
// Required methods
fn len(self) -> usize;
fn get(self, key: &str) -> Option<Self::JsonRef>;
fn list(self) -> Vec<(&'a str, Self::JsonRef)>;
fn list_value(self) -> Vec<Self::JsonRef>;
// Provided method
fn is_empty(self) -> bool { ... }
}
Expand description
A trait for borrowed JSON objects.
Required Associated Types§
Required Methods§
fn len(self) -> usize
Sourcefn get(self, key: &str) -> Option<Self::JsonRef>
fn get(self, key: &str) -> Option<Self::JsonRef>
Returns the value associated with the given key.
Sourcefn list_value(self) -> Vec<Self::JsonRef>
fn list_value(self) -> Vec<Self::JsonRef>
Returns all values in the 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.