pub enum Value {
    Bool(bool),
    I64(i64),
    U64(u64),
    F64(f64),
    String(String),
    Array(Array<Value>),
    Object(Object<Value>),
}
Expand description

Represents a boxed value.

Variants§

§

Bool(bool)

A boolean value.

§

I64(i64)

A signed integer value.

§

U64(u64)

An unsigned integer value.

§

F64(f64)

A floating point value.

§

String(String)

A string value.

§

Array(Array<Value>)

An array of annotated values.

§

Object(Object<Value>)

A mapping of strings to annotated values.

Implementations§

source§

impl Value

source

pub fn describe(&self) -> ValueDescription<'_>

Returns a formattable that gives a helper description of the value.

source

pub fn as_str(&self) -> Option<&str>

Returns the string if this value is a string, otherwise None.

Trait Implementations§

source§

impl Clone for Value

source§

fn clone(&self) -> Value

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Value

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for Value

source§

fn deserialize<D>(deserializer: D) -> Result<Value, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Empty for Value

source§

fn is_empty(&self) -> bool

Returns whether this value is empty.
source§

fn is_deep_empty(&self) -> bool

Returns whether this value is empty or all of its descendants are empty. Read more
source§

impl<'a> From<&'a Value> for Val<'a>

source§

fn from(value: &'a Value) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a str> for Value

source§

fn from(value: &'a str) -> Self

Converts to this type from the input type.
source§

impl From<BTreeMap<String, Annotated<Value>>> for Value

source§

fn from(value: Object<Value>) -> Self

Converts to this type from the input type.
source§

impl From<String> for Value

source§

fn from(value: String) -> Self

Converts to this type from the input type.
source§

impl From<Value> for Value

source§

fn from(value: Value) -> Value

Converts to this type from the input type.
source§

impl From<Vec<Annotated<Value>>> for Value

source§

fn from(value: Array<Value>) -> Self

Converts to this type from the input type.
source§

impl From<bool> for Value

source§

fn from(value: bool) -> Self

Converts to this type from the input type.
source§

impl From<f64> for Value

source§

fn from(value: f64) -> Self

Converts to this type from the input type.
source§

impl From<i64> for Value

source§

fn from(value: i64) -> Self

Converts to this type from the input type.
source§

impl From<u64> for Value

source§

fn from(value: u64) -> Self

Converts to this type from the input type.
source§

impl FromValue for Value

source§

fn from_value(value: Annotated<Value>) -> Annotated<Value>

Creates a meta structure from an annotated boxed value.
source§

impl IntoValue for Value

source§

fn into_value(self) -> Value

Boxes the meta structure back into a value.
source§

fn serialize_payload<S>( &self, s: S, _behavior: SkipSerialization ) -> Result<S::Ok, S::Error>
where Self: Sized, S: Serializer,

Efficiently serializes the payload directly.
source§

fn extract_child_meta(&self) -> Map<String, MetaTree>
where Self: Sized,

Extracts children meta map out of a value.
source§

fn extract_meta_tree(value: &Annotated<Self>) -> MetaTree
where Self: Sized,

Extracts the meta tree out of annotated value. Read more
source§

impl JsonSchema for Value

source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
source§

fn json_schema(_gen: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
source§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
source§

impl PartialEq for Value

source§

fn eq(&self, other: &Value) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Value

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl TryFrom<&Value> for String

§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from(value: &Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl StructuralPartialEq for Value

Auto Trait Implementations§

§

impl Freeze for Value

§

impl RefUnwindSafe for Value

§

impl Send for Value

§

impl Sync for Value

§

impl Unpin for Value

§

impl UnwindSafe for Value

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,