#[non_exhaustive]pub enum JsonTopLevelKind {
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
ⓘ
#![deny(unused_must_use)]
use qubit_json::JsonTopLevelKind;
fn top_level_kind() -> JsonTopLevelKind {
JsonTopLevelKind::Other
}
top_level_kind();Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future 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 JsonTopLevelKind
impl JsonTopLevelKind
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 JsonTopLevelKind
impl Clone for JsonTopLevelKind
Source§fn clone(&self) -> JsonTopLevelKind
fn clone(&self) -> JsonTopLevelKind
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 JsonTopLevelKind
Source§impl Debug for JsonTopLevelKind
impl Debug for JsonTopLevelKind
Source§impl Display for JsonTopLevelKind
impl Display for JsonTopLevelKind
impl Eq for JsonTopLevelKind
Source§impl From<&Value> for JsonTopLevelKind
impl From<&Value> for JsonTopLevelKind
Source§impl Hash for JsonTopLevelKind
impl Hash for JsonTopLevelKind
Source§impl PartialEq for JsonTopLevelKind
impl PartialEq for JsonTopLevelKind
impl StructuralPartialEq for JsonTopLevelKind
Auto Trait Implementations§
impl Freeze for JsonTopLevelKind
impl RefUnwindSafe for JsonTopLevelKind
impl Send for JsonTopLevelKind
impl Sync for JsonTopLevelKind
impl Unpin for JsonTopLevelKind
impl UnsafeUnpin for JsonTopLevelKind
impl UnwindSafe for JsonTopLevelKind
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