Enum tremor_value::value::Value[][src]

pub enum Value<'value> {
    Static(StaticNode),
    String(Cow<'value, str>),
    Array(Vec<Value<'value>>),
    Object(Box<Object<'value>>),
    Bytes(Bytes<'value>),
}
Expand description

Borrowed JSON-DOM Value, consider using the ValueTrait to access its content

Variants

Static(StaticNode)

Static values

String(Cow<'value, str>)

string type

Array(Vec<Value<'value>>)

array type

Object(Box<Object<'value>>)

object type

Bytes(Bytes<'value>)

A binary type

Implementations

impl<'value> Value<'value>[src]

#[must_use]
pub fn array() -> Self
[src]

Creates an empty array value

impl<'value> Value<'value>[src]

#[must_use]
pub fn into_static(self) -> Value<'static>
[src]

Enforces static lifetime on a borrowed value, this will force all strings to become owned COW’s, the same applies for Object keys.

#[must_use]
pub fn clone_static(&self) -> Value<'static>
[src]

Clones the current value and enforces a static lifetime, it works the same as into_static but includes cloning logic

#[must_use]
pub fn as_bytes(&self) -> Option<&[u8]>
[src]

Tries to get the bytes from a Value

#[must_use]
pub fn get_bytes<Q: ?Sized>(&self, k: &Q) -> Option<&[u8]> where
    Cow<'value, str>: Borrow<Q> + Hash + Eq,
    Q: Hash + Eq + Ord
[src]

Tries to get an element of an object as bytes

#[must_use]
pub fn as_char(&self) -> Option<char>
[src]

Tries to get the value as a char

#[must_use]
pub fn is_char(&self) -> bool
[src]

Tests if the value can be represented as a char

#[must_use]
pub fn get_char<Q: ?Sized>(&self, k: &Q) -> Option<char> where
    Cow<'value, str>: Borrow<Q> + Hash + Eq,
    Q: Hash + Eq + Ord
[src]

Tries to get an element of an object as char, takes the first one if it is a string

Trait Implementations

impl<'value> Builder<'value> for Value<'value>[src]

#[must_use]
fn null() -> Self
[src]

Returns anull value

#[must_use]
fn array_with_capacity(capacity: usize) -> Self
[src]

Returns an empty array with a given capacity

#[must_use]
fn object_with_capacity(capacity: usize) -> Self
[src]

Returns an empty object with a given capacity

#[must_use]
fn array() -> Self
[src]

Returns an empty array

#[must_use]
fn object() -> Self
[src]

Returns an empty object

impl<'value> Clone for Value<'value>[src]

fn clone(&self) -> Value<'value>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'value> Debug for Value<'value>[src]

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

Formats the value using the given formatter. Read more

impl<'value> Default for Value<'value>[src]

#[must_use]
fn default() -> Self
[src]

Returns the “default value” for a type. Read more

impl<'de> Deserialize<'de> for Value<'de>[src]

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

Deserialize this value from the given Serde deserializer. Read more

impl<'input> Deserialize<'input> for Value<'input>[src]

fn from_tape(tape: &mut Tape<'input>) -> Result<Self> where
    Self: Sized + 'input, 
[src]

fn from_slice(json: &'input mut [u8]) -> Result<Self, Error> where
    Self: 'input, 
[src]

fn from_slice_with_buffer(
    json: &'input mut [u8],
    string_buffer: &mut [u8]
) -> Result<Self, Error> where
    Self: 'input, 
[src]

fn from_slice_with_buffers(
    json: &'input mut [u8],
    input_buffer: &mut AlignedBuf,
    string_buffer: &mut [u8]
) -> Result<Self, Error> where
    Self: 'input, 
[src]

fn from_str(json: &'input mut str) -> Result<Self, Error> where
    Self: 'input, 
[src]

impl<'de> Deserializer<'de> for Value<'de>[src]

type Error = Error

The error type that can be returned if some error occurs during deserialization. Read more

fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Error> where
    V: Visitor<'de>, 
[src]

Require the Deserializer to figure out how to drive the visitor based on what data type is in the input. Read more

fn deserialize_option<V>(self, visitor: V) -> Result<V::Value, Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting an optional value. Read more

fn deserialize_struct<V>(
    self,
    _name: &'static str,
    _fields: &'static [&'static str],
    visitor: V
) -> Result<V::Value, Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting a struct with a particular name and fields. Read more

fn deserialize_bool<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting a bool value.

fn deserialize_i8<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting an i8 value.

fn deserialize_i16<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting an i16 value.

fn deserialize_i32<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting an i32 value.

fn deserialize_i64<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting an i64 value.

fn deserialize_i128<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting an i128 value. Read more

fn deserialize_u8<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting a u8 value.

fn deserialize_u16<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting a u16 value.

fn deserialize_u32<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting a u32 value.

fn deserialize_u64<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting a u64 value.

fn deserialize_u128<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting an u128 value. Read more

fn deserialize_f32<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting a f32 value.

fn deserialize_f64<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting a f64 value.

fn deserialize_char<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting a char value.

fn deserialize_str<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting a string value and does not benefit from taking ownership of buffered data owned by the Deserializer. Read more

fn deserialize_string<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting a string value and would benefit from taking ownership of buffered data owned by the Deserializer. Read more

fn deserialize_bytes<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting a byte array and does not benefit from taking ownership of buffered data owned by the Deserializer. Read more

fn deserialize_byte_buf<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting a byte array and would benefit from taking ownership of buffered data owned by the Deserializer. Read more

fn deserialize_unit<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting a unit value.

fn deserialize_unit_struct<V>(
    self,
    name: &'static str,
    visitor: V
) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting a unit struct with a particular name. Read more

fn deserialize_newtype_struct<V>(
    self,
    name: &'static str,
    visitor: V
) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting a newtype struct with a particular name. Read more

fn deserialize_seq<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting a sequence of values.

fn deserialize_tuple<V>(
    self,
    len: usize,
    visitor: V
) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting a sequence of values and knows how many values there are without looking at the serialized data. Read more

fn deserialize_tuple_struct<V>(
    self,
    name: &'static str,
    len: usize,
    visitor: V
) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting a tuple struct with a particular name and number of fields. Read more

fn deserialize_map<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting a map of key-value pairs.

fn deserialize_enum<V>(
    self,
    name: &'static str,
    variants: &'static [&'static str],
    visitor: V
) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting an enum value with a particular name and possible variants. Read more

fn deserialize_identifier<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type is expecting the name of a struct field or the discriminant of an enum variant. Read more

fn deserialize_ignored_any<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
    V: Visitor<'de>, 
[src]

Hint that the Deserialize type needs to deserialize a value whose type doesn’t matter because it is ignored. Read more

fn is_human_readable(&self) -> bool[src]

Determine whether Deserialize implementations should expect to deserialize their human-readable form. Read more

impl<'value> Display for Value<'value>[src]

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

Formats the value using the given formatter. Read more

impl<'value> From<&'value str> for Value<'value>[src]

#[must_use]
fn from(s: &'value str) -> Self
[src]

Performs the conversion.

impl<'value> From<()> for Value<'value>[src]

#[must_use]
fn from(_b: ()) -> Self
[src]

Performs the conversion.

impl<'value> From<Cow<'value, str, Wide>> for Value<'value>[src]

#[must_use]
fn from(c: Cow<'value, str>) -> Self
[src]

Performs the conversion.

impl<'value> From<Cow<'value, str>> for Value<'value>[src]

#[must_use]
fn from(c: Cow<'value, str>) -> Self
[src]

Performs the conversion.

impl<'value> From<HashMap<Cow<'value, str, Wide>, Value<'value>, BuildHasherDefault<FxHasher>>> for Value<'value>[src]

#[must_use]
fn from(v: Object<'value>) -> Self
[src]

Performs the conversion.

impl<'value, T> From<Option<T>> for Value<'value> where
    Value<'value>: From<T>, 
[src]

#[must_use]
fn from(s: Option<T>) -> Self
[src]

Performs the conversion.

impl<'value> From<StaticNode> for Value<'value>[src]

#[must_use]
fn from(s: StaticNode) -> Self
[src]

Performs the conversion.

impl<'value> From<String> for Value<'value>[src]

#[must_use]
fn from(s: String) -> Self
[src]

Performs the conversion.

impl<'value> From<Value<'value>> for Value<'value>[src]

#[must_use]
fn from(b: BorrowedValue<'value>) -> Self
[src]

Performs the conversion.

impl<'value> From<Value> for Value<'value>[src]

#[must_use]
fn from(b: OwnedValue) -> Self
[src]

Performs the conversion.

impl<'value, S> From<Vec<S, Global>> for Value<'value> where
    Value<'value>: From<S>, 
[src]

#[must_use]
fn from(v: Vec<S>) -> Self
[src]

Performs the conversion.

impl<'value> From<bool> for Value<'value>[src]

#[must_use]
fn from(b: bool) -> Self
[src]

Performs the conversion.

impl<'value> From<f32> for Value<'value>[src]

#[must_use]
fn from(f: f32) -> Self
[src]

Performs the conversion.

impl<'value> From<f64> for Value<'value>[src]

#[must_use]
fn from(f: f64) -> Self
[src]

Performs the conversion.

impl<'value> From<i16> for Value<'value>[src]

#[must_use]
fn from(i: i16) -> Self
[src]

Performs the conversion.

impl<'value> From<i32> for Value<'value>[src]

#[must_use]
fn from(i: i32) -> Self
[src]

Performs the conversion.

impl<'value> From<i64> for Value<'value>[src]

#[must_use]
fn from(i: i64) -> Self
[src]

Performs the conversion.

impl<'value> From<i8> for Value<'value>[src]

#[must_use]
fn from(i: i8) -> Self
[src]

Performs the conversion.

impl<'value> From<u16> for Value<'value>[src]

#[must_use]
fn from(i: u16) -> Self
[src]

Performs the conversion.

impl<'value> From<u32> for Value<'value>[src]

#[must_use]
fn from(i: u32) -> Self
[src]

Performs the conversion.

impl<'value> From<u64> for Value<'value>[src]

#[must_use]
fn from(i: u64) -> Self
[src]

Performs the conversion.

impl<'value> From<u8> for Value<'value>[src]

#[must_use]
fn from(i: u8) -> Self
[src]

Performs the conversion.

impl<'value> From<usize> for Value<'value>[src]

#[must_use]
fn from(i: usize) -> Self
[src]

Performs the conversion.

impl<'value, K: Into<Cow<'value, str>>, V: Into<Value<'value>>> FromIterator<(K, V)> for Value<'value>[src]

#[must_use]
fn from_iter<I: IntoIterator<Item = (K, V)>>(iter: I) -> Self
[src]

Creates a value from an iterator. Read more

impl<'value, V: Into<Value<'value>>> FromIterator<V> for Value<'value>[src]

#[must_use]
fn from_iter<I: IntoIterator<Item = V>>(iter: I) -> Self
[src]

Creates a value from an iterator. Read more

impl<'value> Index<&'_ str> for Value<'value>[src]

type Output = Value<'value>

The returned type after indexing.

#[must_use]
fn index(&self, index: &str) -> &Self::Output
[src]

Performs the indexing (container[index]) operation. Read more

impl<'value> Index<usize> for Value<'value>[src]

type Output = Value<'value>

The returned type after indexing.

#[must_use]
fn index(&self, index: usize) -> &Self::Output
[src]

Performs the indexing (container[index]) operation. Read more

impl<'value> IndexMut<&'_ str> for Value<'value>[src]

#[must_use]
fn index_mut(&mut self, index: &str) -> &mut Self::Output
[src]

Performs the mutable indexing (container[index]) operation. Read more

impl<'value> IndexMut<usize> for Value<'value>[src]

#[must_use]
fn index_mut(&mut self, index: usize) -> &mut Self::Output
[src]

Performs the mutable indexing (container[index]) operation. Read more

impl<'value> Mutable for Value<'value>[src]

#[must_use]
fn as_array_mut(&mut self) -> Option<&mut Vec<Value<'value>>>
[src]

Tries to represent the value as an array and returns a mutable refference to it

#[must_use]
fn as_object_mut(&mut self) -> Option<&mut HashMap<Self::Key, Self>>
[src]

Tries to represent the value as an object and returns a mutable refference to it

fn insert<K, V>(
    &mut self,
    k: K,
    v: V
) -> Result<Option<Self::Target>, AccessError> where
    V: Into<Self::Target>,
    K: Into<Self::Key>,
    Self::Key: Hash,
    Self::Key: Eq
[src]

Insert into this Value as an Object. Will return an AccessError::NotAnObject if called on a Value that isn’t an object - otherwise will behave the same as HashMap::insert Read more

fn try_insert<K, V>(&mut self, k: K, v: V) -> Option<Self::Target> where
    V: Into<Self::Target>,
    K: Into<Self::Key>,
    Self::Key: Hash,
    Self::Key: Eq
[src]

Tries to insert into this Value as an Object. If the Value isn’t an object this opoeration will return None and have no effect. Read more

fn remove<Q>(&mut self, k: &Q) -> Result<Option<Self::Target>, AccessError> where
    Q: Hash + Eq + Ord + ?Sized,
    Self::Key: Borrow<Q>,
    Self::Key: Hash,
    Self::Key: Eq
[src]

Remove from this Value as an Object. Will return an AccessError::NotAnObject if called on a Value that isn’t an object - otherwise will behave the same as HashMap::remove Read more

fn try_remove<Q>(&mut self, k: &Q) -> Option<Self::Target> where
    Q: Hash + Eq + Ord + ?Sized,
    Self::Key: Borrow<Q>,
    Self::Key: Hash,
    Self::Key: Eq
[src]

Tries to remove from this Value as an Object. If the Value isn’t an object this opoeration will return None and have no effect. Read more

fn push<V>(&mut self, v: V) -> Result<(), AccessError> where
    V: Into<Self::Target>, 
[src]

Pushes to this Value as an Array. Will return an AccessError::NotAnArray if called on a Value that isn’t an Array - otherwise will behave the same as Vec::push Read more

fn try_push<V>(&mut self, v: V) where
    V: Into<Self::Target>, 
[src]

Tries to push to a Value if as an Array. This funciton will have no effect if Value is of a different type Read more

fn pop(&mut self) -> Result<Option<Self::Target>, AccessError>[src]

Pops from this Value as an Array. Will return an AccessError::NotAnArray if called on a Value that isn’t an Array - otherwise will behave the same as Vec::pop Read more

fn try_pop(&mut self) -> Option<Self::Target>[src]

Tries to pop from a Value as an Array. if the Value is any other type None will always be returned Read more

fn get_mut<Q>(&mut self, k: &Q) -> Option<&mut Self::Target> where
    Q: Hash + Eq + Ord + ?Sized,
    Self::Key: Borrow<Q>,
    Self::Key: Hash,
    Self::Key: Eq
[src]

Same as get but returns a mutable ref instead

fn get_idx_mut(&mut self, i: usize) -> Option<&mut Self::Target>[src]

Same as get_idx but returns a mutable ref instead

impl<'value> Ord for Value<'value>[src]

fn cmp(&self, other: &Self) -> Ordering[src]

This method returns an Ordering between self and other. Read more

#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]

Compares and returns the maximum of two values. Read more

#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]

Compares and returns the minimum of two values. Read more

#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]

Restrict a value to a certain interval. Read more

impl<'v, T> PartialEq<&'_ [T]> for Value<'v> where
    Value<'v>: PartialEq<T>, 
[src]

#[must_use]
fn eq(&self, other: &&[T]) -> bool
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'value, T> PartialEq<&'_ T> for Value<'value> where
    Value<'value>: PartialEq<T>, 
[src]

#[must_use]
fn eq(&self, other: &&T) -> bool
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'v> PartialEq<&'_ str> for Value<'v>[src]

#[must_use]
fn eq(&self, other: &&str) -> bool
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'v> PartialEq<()> for Value<'v>[src]

#[must_use]
fn eq(&self, _other: &()) -> bool
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'v> PartialEq<Cow<'v, str, Wide>> for Value<'v>[src]

#[must_use]
fn eq(&self, other: &Cow<'_, str>) -> bool
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'v> PartialEq<Cow<'v, str>> for Value<'v>[src]

#[must_use]
fn eq(&self, other: &Cow<'_, str>) -> bool
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'v, K, T, S> PartialEq<HashMap<K, T, S>> for Value<'v> where
    K: AsRef<str> + Hash + Eq,
    Value<'v>: PartialEq<T>,
    S: BuildHasher
[src]

#[must_use]
fn eq(&self, other: &HashMap<K, T, S>) -> bool
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'v> PartialEq<String> for Value<'v>[src]

#[must_use]
fn eq(&self, other: &String) -> bool
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'value> PartialEq<Value<'value>> for Value<'value>[src]

#[must_use]
fn eq(&self, other: &Self) -> bool
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'value> PartialEq<Value<'value>> for Value<'value>[src]

#[must_use]
fn eq(&self, other: &BorrowedValue<'_>) -> bool
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'value> PartialEq<Value> for Value<'value>[src]

#[must_use]
fn eq(&self, other: &OwnedValue) -> bool
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'v> PartialEq<bool> for Value<'v>[src]

#[must_use]
fn eq(&self, other: &bool) -> bool
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'v> PartialEq<f32> for Value<'v>[src]

#[must_use]
fn eq(&self, other: &f32) -> bool
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'v> PartialEq<f64> for Value<'v>[src]

#[must_use]
fn eq(&self, other: &f64) -> bool
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'v> PartialEq<i128> for Value<'v>[src]

#[must_use]
fn eq(&self, other: &i128) -> bool
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'v> PartialEq<i16> for Value<'v>[src]

#[must_use]
fn eq(&self, other: &i16) -> bool
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'v> PartialEq<i32> for Value<'v>[src]

#[must_use]
fn eq(&self, other: &i32) -> bool
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'v> PartialEq<i64> for Value<'v>[src]

#[must_use]
fn eq(&self, other: &i64) -> bool
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'v> PartialEq<i8> for Value<'v>[src]

#[must_use]
fn eq(&self, other: &i8) -> bool
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'v> PartialEq<str> for Value<'v>[src]

#[must_use]
fn eq(&self, other: &str) -> bool
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'v> PartialEq<u128> for Value<'v>[src]

#[must_use]
fn eq(&self, other: &u128) -> bool
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'v> PartialEq<u16> for Value<'v>[src]

#[must_use]
fn eq(&self, other: &u16) -> bool
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'v> PartialEq<u32> for Value<'v>[src]

#[must_use]
fn eq(&self, other: &u32) -> bool
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'v> PartialEq<u64> for Value<'v>[src]

#[must_use]
fn eq(&self, other: &u64) -> bool
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'v> PartialEq<u8> for Value<'v>[src]

#[must_use]
fn eq(&self, other: &u8) -> bool
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'v> PartialEq<usize> for Value<'v>[src]

#[must_use]
fn eq(&self, other: &usize) -> bool
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'value> PartialOrd<Value<'value>> for Value<'value>[src]

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

This method returns an ordering between self and other values if one exists. Read more

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<'value> Serialize for Value<'value>[src]

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

Serialize this value into the given Serde serializer. Read more

impl<'value> Serialize for Value<'value>[src]

fn json_write<W>(&self, writer: &mut W) -> Result<()> where
    W: Write
[src]

fn json_vec(&self) -> Result<Vec<u8, Global>, Error>[src]

fn json_string(&self) -> Result<String, Error>[src]

impl<'value> Value for Value<'value>[src]

#[must_use]
fn is_custom(&self) -> bool
[src]

returns if a type is a custom type

#[must_use]
fn value_type(&self) -> ValueType
[src]

Returns the type of the current Valye

#[must_use]
fn is_null(&self) -> bool
[src]

returns true if the current value is null

#[must_use]
fn is_float(&self) -> bool
[src]

returns true if the current value a floatingpoint number

#[must_use]
fn is_integer(&self) -> bool
[src]

returns true if the current value a integer number

#[must_use]
fn is_number(&self) -> bool
[src]

returns true if the current value a number either float or integer

#[must_use]
fn is_bool(&self) -> bool
[src]

returns true if the current value a bool

#[must_use]
fn is_i128(&self) -> bool
[src]

returns true if the current value can be represented as a i128

#[must_use]
fn is_i64(&self) -> bool
[src]

returns true if the current value can be represented as a i64

#[must_use]
fn is_i32(&self) -> bool
[src]

returns true if the current value can be represented as a i32

#[must_use]
fn is_i16(&self) -> bool
[src]

returns true if the current value can be represented as a i16

#[must_use]
fn is_i8(&self) -> bool
[src]

returns true if the current value can be represented as a i8

#[must_use]
fn is_u128(&self) -> bool
[src]

returns true if the current value can be represented as a u128

#[must_use]
fn is_u64(&self) -> bool
[src]

returns true if the current value can be represented as a u64

#[must_use]
fn is_usize(&self) -> bool
[src]

returns true if the current value can be represented as a usize

#[must_use]
fn is_u32(&self) -> bool
[src]

returns true if the current value can be represented as a u32

#[must_use]
fn is_u16(&self) -> bool
[src]

returns true if the current value can be represented as a u16

#[must_use]
fn is_u8(&self) -> bool
[src]

returns true if the current value can be represented as a u8

#[must_use]
fn is_f64(&self) -> bool
[src]

returns true if the current value can be represented as a f64

#[must_use]
fn is_f64_castable(&self) -> bool
[src]

returns true if the current value can be cast into a f64

#[must_use]
fn is_f32(&self) -> bool
[src]

returns true if the current value can be represented as a f64

#[must_use]
fn is_str(&self) -> bool
[src]

returns true if the current value can be represented as a str

#[must_use]
fn is_char(&self) -> bool
[src]

returns true if the current value can be represented as a char

#[must_use]
fn is_array(&self) -> bool
[src]

returns true if the current value can be represented as an array

#[must_use]
fn is_object(&self) -> bool
[src]

returns true if the current value can be represented as an object

impl<'value> ValueAccess for Value<'value>[src]

type Target = Self

The target for nested lookups

type Key = Cow<'value, str>

The type for Objects

type Array = Vec<Self>

The array structure

type Object = HashMap<Self::Key, Self>

The object structure

#[must_use]
fn as_bool(&self) -> Option<bool>
[src]

Tries to represent the value as a bool

#[must_use]
fn as_i64(&self) -> Option<i64>
[src]

Tries to represent the value as an i64

#[must_use]
fn as_i128(&self) -> Option<i128>
[src]

Tries to represent the value as an i128

#[must_use]
fn as_u64(&self) -> Option<u64>
[src]

Tries to represent the value as an u64

#[must_use]
fn as_f64(&self) -> Option<f64>
[src]

Tries to represent the value as a f64

#[must_use]
fn cast_f64(&self) -> Option<f64>
[src]

Casts the current value to a f64 if possible, this will turn integer values into floats. Read more

#[must_use]
fn as_str(&self) -> Option<&str>
[src]

Tries to represent the value as a &str

#[must_use]
fn as_array(&self) -> Option<&Vec<Value<'value>>>
[src]

Tries to represent the value as an array and returns a refference to it

#[must_use]
fn as_object(&self) -> Option<&HashMap<Self::Key, Self>>
[src]

Tries to represent the value as an object and returns a refference to it

#[must_use]
fn get<Q>(&self, k: &Q) -> Option<&Self::Target> where
    Q: Hash + Eq + Ord + ?Sized,
    Self::Key: Borrow<Q>,
    Self::Key: Hash,
    Self::Key: Eq
[src]

Gets a ref to a value based on a key, returns None if the current Value isn’t an Object or doesn’t contain the key it was asked for. Read more

#[must_use]
fn contains_key<Q>(&self, k: &Q) -> bool where
    Q: Hash + Eq + Ord + ?Sized,
    Self::Key: Borrow<Q>,
    Self::Key: Hash,
    Self::Key: Eq
[src]

Checks if a Value contains a given key. This will return flase if Value isn’t an object Read more

#[must_use]
fn get_idx(&self, i: usize) -> Option<&Self::Target>
[src]

Gets a ref to a value based on n index, returns None if the current Value isn’t an Array or doesn’t contain the index it was asked for. Read more

#[must_use]
fn get_bool<Q>(&self, k: &Q) -> Option<bool> where
    Q: Hash + Eq + Ord + ?Sized,
    Self::Key: Borrow<Q>,
    Self::Key: Hash,
    Self::Key: Eq
[src]

Tries to get an element of an object as a bool

#[must_use]
fn get_i128<Q>(&self, k: &Q) -> Option<i128> where
    Q: Hash + Eq + Ord + ?Sized,
    Self::Key: Borrow<Q>,
    Self::Key: Hash,
    Self::Key: Eq
[src]

Tries to get an element of an object as a i128

#[must_use]
fn get_i64<Q>(&self, k: &Q) -> Option<i64> where
    Q: Hash + Eq + Ord + ?Sized,
    Self::Key: Borrow<Q>,
    Self::Key: Hash,
    Self::Key: Eq
[src]

Tries to get an element of an object as a i64

#[must_use]
fn as_i32(&self) -> Option<i32>
[src]

Tries to represent the value as an i32

#[must_use]
fn get_i32<Q>(&self, k: &Q) -> Option<i32> where
    Q: Hash + Eq + Ord + ?Sized,
    Self::Key: Borrow<Q>,
    Self::Key: Hash,
    Self::Key: Eq
[src]

Tries to get an element of an object as a i32

#[must_use]
fn as_i16(&self) -> Option<i16>
[src]

Tries to represent the value as an i16

#[must_use]
fn get_i16<Q>(&self, k: &Q) -> Option<i16> where
    Q: Hash + Eq + Ord + ?Sized,
    Self::Key: Borrow<Q>,
    Self::Key: Hash,
    Self::Key: Eq
[src]

Tries to get an element of an object as a i16

#[must_use]
fn as_i8(&self) -> Option<i8>
[src]

Tries to represent the value as an i8

#[must_use]
fn get_i8<Q>(&self, k: &Q) -> Option<i8> where
    Q: Hash + Eq + Ord + ?Sized,
    Self::Key: Borrow<Q>,
    Self::Key: Hash,
    Self::Key: Eq
[src]

Tries to get an element of an object as a i8

#[must_use]
fn as_u128(&self) -> Option<u128>
[src]

Tries to represent the value as an u128

#[must_use]
fn get_u128<Q>(&self, k: &Q) -> Option<u128> where
    Q: Hash + Eq + Ord + ?Sized,
    Self::Key: Borrow<Q>,
    Self::Key: Hash,
    Self::Key: Eq
[src]

Tries to get an element of an object as a u128

#[must_use]
fn get_u64<Q>(&self, k: &Q) -> Option<u64> where
    Q: Hash + Eq + Ord + ?Sized,
    Self::Key: Borrow<Q>,
    Self::Key: Hash,
    Self::Key: Eq
[src]

Tries to get an element of an object as a u64

#[must_use]
fn as_usize(&self) -> Option<usize>
[src]

Tries to represent the value as an usize

#[must_use]
fn get_usize<Q>(&self, k: &Q) -> Option<usize> where
    Q: Hash + Eq + Ord + ?Sized,
    Self::Key: Borrow<Q>,
    Self::Key: Hash,
    Self::Key: Eq
[src]

Tries to get an element of an object as a usize

#[must_use]
fn as_u32(&self) -> Option<u32>
[src]

Tries to represent the value as an u32

#[must_use]
fn get_u32<Q>(&self, k: &Q) -> Option<u32> where
    Q: Hash + Eq + Ord + ?Sized,
    Self::Key: Borrow<Q>,
    Self::Key: Hash,
    Self::Key: Eq
[src]

Tries to get an element of an object as a u32

#[must_use]
fn as_u16(&self) -> Option<u16>
[src]

Tries to represent the value as an u16

#[must_use]
fn get_u16<Q>(&self, k: &Q) -> Option<u16> where
    Q: Hash + Eq + Ord + ?Sized,
    Self::Key: Borrow<Q>,
    Self::Key: Hash,
    Self::Key: Eq
[src]

Tries to get an element of an object as a u16

#[must_use]
fn as_u8(&self) -> Option<u8>
[src]

Tries to represent the value as an u8

#[must_use]
fn get_u8<Q>(&self, k: &Q) -> Option<u8> where
    Q: Hash + Eq + Ord + ?Sized,
    Self::Key: Borrow<Q>,
    Self::Key: Hash,
    Self::Key: Eq
[src]

Tries to get an element of an object as a u8

#[must_use]
fn get_f64<Q>(&self, k: &Q) -> Option<f64> where
    Q: Hash + Eq + Ord + ?Sized,
    Self::Key: Borrow<Q>,
    Self::Key: Hash,
    Self::Key: Eq
[src]

Tries to get an element of an object as a f64

#[must_use]
fn as_f32(&self) -> Option<f32>
[src]

Tries to represent the value as a f32

#[must_use]
fn get_f32<Q>(&self, k: &Q) -> Option<f32> where
    Q: Hash + Eq + Ord + ?Sized,
    Self::Key: Borrow<Q>,
    Self::Key: Hash,
    Self::Key: Eq
[src]

Tries to get an element of an object as a f32

#[must_use]
fn as_char(&self) -> Option<char>
[src]

Tries to represent the value as a Char

#[must_use]
fn get_str<Q>(&self, k: &Q) -> Option<&str> where
    Q: Hash + Eq + Ord + ?Sized,
    Self::Key: Borrow<Q>,
    Self::Key: Hash,
    Self::Key: Eq
[src]

Tries to get an element of an object as a str

#[must_use]
fn get_array<Q>(&self, k: &Q) -> Option<&<Self::Target as ValueAccess>::Array> where
    Q: Hash + Eq + Ord + ?Sized,
    Self::Key: Borrow<Q>,
    Self::Key: Hash,
    Self::Key: Eq
[src]

Tries to get an element of an object as a array

#[must_use]
fn get_object<Q>(&self, k: &Q) -> Option<&<Self::Target as ValueAccess>::Object> where
    Q: Hash + Eq + Ord + ?Sized,
    Self::Key: Borrow<Q>,
    Self::Key: Hash,
    Self::Key: Eq
[src]

Tries to get an element of an object as a object

impl<'value> Writable for Value<'value>[src]

fn encode(&self) -> String[src]

Encodes the value into it’s JSON representation as a string

fn encode_pp(&self) -> String[src]

Encodes the value into it’s JSON representation as a string (pretty printed)

fn write<'writer, W>(&self, w: &mut W) -> Result<()> where
    W: 'writer + Write
[src]

Encodes the value into it’s JSON representation into a Writer Read more

fn write_pp<'writer, W>(&self, w: &mut W) -> Result<()> where
    W: 'writer + Write
[src]

Encodes the value into it’s JSON representation into a Writer, pretty printed Read more

impl<'value> Eq for Value<'value>[src]

Auto Trait Implementations

impl<'value> RefUnwindSafe for Value<'value>

impl<'value> Send for Value<'value>

impl<'value> Sync for Value<'value>

impl<'value> Unpin for Value<'value>

impl<'value> UnwindSafe for Value<'value>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

impl<T> ToString for T where
    T: Display + ?Sized
[src]

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.