Value

Enum Value 

Source
pub enum Value {
    List(Vec<Value>),
    Map(HashMap<String, Value>),
    Optional(Option<Box<Value>>),
    Primitive(Primitive),
    Text(String),
}
Expand description

Represents either a primitive or complex value

Variants§

§

List(Vec<Value>)

§

Map(HashMap<String, Value>)

§

Optional(Option<Box<Value>>)

§

Primitive(Primitive)

§

Text(String)

Implementations§

Source§

impl Value

Source

pub fn is_type(&self, type: ValueType) -> bool

Returns true if this value is of the specified type

Source

pub fn to_type(&self) -> ValueType

Returns the type of this value

Source

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

Returns true if this value and the other value are of the same type

Source

pub fn is_complex(&self) -> bool

Returns true if not representing a primitive value

Source

pub fn is_primitive(&self) -> bool

Returns true if representing a primitive value

Source

pub fn to_primitive(&self) -> Option<Primitive>

Converts into underlying primitive value if representing one

Source

pub fn to_primitive_type(&self) -> Option<PrimitiveType>

Converts into underlying primitive type if representing one

Trait Implementations§

Source§

impl Clone for Value

Source§

fn clone(&self) -> Value

Returns a duplicate 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<'a> From<&'a OsStr> for Value

Source§

fn from(s: &'a OsStr) -> Self

Converts to this type from the input type.
Source§

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

Source§

fn from(p: &'a Path) -> Self

Converts to this type from the input type.
Source§

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

Source§

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

Produces the type of the referenced value by recursively iterating through complex types, assuming that the first value in types like list represent the entire set, defaulting to a primitive unit if a complex value does not have any items

Source§

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

Source§

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

Converts to this type from the input type.
Source§

impl<T: ValueLike> From<BTreeMap<String, T>> for Value

Source§

fn from(x: BTreeMap<String, T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ValueLike + Ord> From<BTreeSet<T>> for Value

Source§

fn from(x: BTreeSet<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ValueLike + Ord> From<BinaryHeap<T>> for Value

Source§

fn from(x: BinaryHeap<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ValueLike> From<HashMap<String, T>> for Value

Source§

fn from(x: HashMap<String, T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ValueLike + Hash + Eq> From<HashSet<T>> for Value

Source§

fn from(x: HashSet<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ValueLike> From<LinkedList<T>> for Value

Source§

fn from(x: LinkedList<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ValueLike> From<Option<T>> for Value

Source§

fn from(x: Option<T>) -> Self

Converts to this type from the input type.
Source§

impl From<OsString> for Value

Source§

fn from(x: OsString) -> Self

Converts to this type from the input type.
Source§

impl From<PathBuf> for Value

Source§

fn from(x: PathBuf) -> Self

Converts to this type from the input type.
Source§

impl From<Primitive> for Value

Source§

fn from(x: Primitive) -> Self

Converts to this type from the input type.
Source§

impl From<String> for Value

Source§

fn from(x: String) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for ValueType

Source§

fn from(value: Value) -> Self

Converts to this type from the input type.
Source§

impl<T: ValueLike> From<Vec<T>> for Value

Source§

fn from(x: Vec<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ValueLike> From<VecDeque<T>> for Value

Source§

fn from(x: VecDeque<T>) -> Self

Converts to this type from the input type.
Source§

impl From<bool> for Value

Source§

fn from(x: bool) -> Self

Converts to this type from the input type.
Source§

impl From<char> for Value

Source§

fn from(x: char) -> Self

Converts to this type from the input type.
Source§

impl From<f32> for Value

Source§

fn from(x: f32) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for Value

Source§

fn from(x: f64) -> Self

Converts to this type from the input type.
Source§

impl From<i128> for Value

Source§

fn from(x: i128) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for Value

Source§

fn from(x: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for Value

Source§

fn from(x: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for Value

Source§

fn from(x: i64) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for Value

Source§

fn from(x: i8) -> Self

Converts to this type from the input type.
Source§

impl From<isize> for Value

Source§

fn from(x: isize) -> Self

Converts to this type from the input type.
Source§

impl From<u128> for Value

Source§

fn from(x: u128) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for Value

Source§

fn from(x: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Value

Source§

fn from(x: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for Value

Source§

fn from(x: u64) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Value

Source§

fn from(x: u8) -> Self

Converts to this type from the input type.
Source§

impl From<usize> for Value

Source§

fn from(x: usize) -> Self

Converts to this type from the input type.
Source§

impl Hash for Value

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Value

Source§

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

Compares two values of same type for equality, otherwise returns false

1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Value

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

Compares same variants for ordering, otherwise returns none

1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T: ValueLike> TryFrom<Value> for BTreeMap<String, T>

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl<T: ValueLike + Ord> TryFrom<Value> for BTreeSet<T>

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl<T: ValueLike + Ord> TryFrom<Value> for BinaryHeap<T>

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl<T: ValueLike> TryFrom<Value> for HashMap<String, T>

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl<T: ValueLike + Hash + Eq> TryFrom<Value> for HashSet<T>

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl<T: ValueLike> TryFrom<Value> for LinkedList<T>

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl TryFrom<Value> for OsString

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl TryFrom<Value> for PathBuf

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl TryFrom<Value> for Primitive

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl TryFrom<Value> for String

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl<T: ValueLike> TryFrom<Value> for Vec<T>

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl<T: ValueLike> TryFrom<Value> for VecDeque<T>

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl TryFrom<Value> for bool

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl TryFrom<Value> for char

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl TryFrom<Value> for f32

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl TryFrom<Value> for f64

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl TryFrom<Value> for i128

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl TryFrom<Value> for i16

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl TryFrom<Value> for i32

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl TryFrom<Value> for i64

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl TryFrom<Value> for i8

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl TryFrom<Value> for isize

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl TryFrom<Value> for u128

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl TryFrom<Value> for u16

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl TryFrom<Value> for u32

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl TryFrom<Value> for u64

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl TryFrom<Value> for u8

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl TryFrom<Value> for usize

Source§

type Error = Value

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

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

Performs the conversion.
Source§

impl ValueLike for Value

Source§

fn into_value(self) -> Value

Consumes this data, converting it into an abstract Value
Source§

fn try_from_value(value: Value) -> Result<Self, Value>

Attempts to convert an abstract Value into this data, returning the owned value back if unable to convert
Source§

impl Eq 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> AsAny for T
where T: 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts reference to Any
Source§

fn as_mut_any(&mut self) -> &mut (dyn Any + 'static)

converts mutable reference to Any
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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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>,

Source§

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>,

Source§

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.