pub enum JsonRootKind {
Object,
Array,
Other,
}Expand description
Represents the top-level kind of a parsed JSON value.
The decoder uses this type to report whether the parsed value is an object, an array, or any other scalar-like JSON value.
§Examples
use qubit_json::decode::JsonRootKind;
let top_level_kind = JsonRootKind::Other;
assert_eq!(top_level_kind.to_string(), "other");Variants§
Object
Indicates that the parsed top-level value is a JSON object.
Array
Indicates that the parsed top-level value is a JSON array.
Other
Indicates that the parsed top-level value is neither an object nor an array.
Implementations§
Source§impl JsonRootKind
impl JsonRootKind
Sourcepub fn of(value: &Value) -> Self
pub fn of(value: &Value) -> Self
Classifies the top-level kind of value.
This helper is used internally by constrained decode methods and may
also be useful to callers inspecting decoded Value instances.
§Parameters
value- JSON value to classify.
§Returns
Self::Object for objects, Self::Array for arrays, and
Self::Other for scalar-like values.
Trait Implementations§
Source§impl Clone for JsonRootKind
impl Clone for JsonRootKind
Source§fn clone(&self) -> JsonRootKind
fn clone(&self) -> JsonRootKind
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for JsonRootKind
Source§impl Debug for JsonRootKind
impl Debug for JsonRootKind
Source§impl Display for JsonRootKind
impl Display for JsonRootKind
impl Eq for JsonRootKind
Source§impl From<&Value> for JsonRootKind
impl From<&Value> for JsonRootKind
Source§impl Hash for JsonRootKind
impl Hash for JsonRootKind
Source§impl PartialEq for JsonRootKind
impl PartialEq for JsonRootKind
impl StructuralPartialEq for JsonRootKind
Auto Trait Implementations§
impl Freeze for JsonRootKind
impl RefUnwindSafe for JsonRootKind
impl Send for JsonRootKind
impl Sync for JsonRootKind
impl Unpin for JsonRootKind
impl UnsafeUnpin for JsonRootKind
impl UnwindSafe for JsonRootKind
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