simd_json::value::lazy

Enum Value

Source
pub enum Value<'borrow, 'tape, 'input> {
    Tape(Value<'tape, 'input>),
    Value(Cow<'borrow, Value<'input>>),
}
Expand description

A lazy value, this gets initialized with a tape and as long as only non mutating operations are performed it will stay a tape. If a mutating operation is performed it will upgrade to a borrowed value.

Variants§

§

Tape(Value<'tape, 'input>)

tape variant

§

Value(Cow<'borrow, Value<'input>>)

borrowed variant

Implementations§

Source§

impl<'borrow, 'tape, 'input> Value<'borrow, 'tape, 'input>
where 'input: 'tape,

Source

pub fn is_array(&self) -> bool

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

Source

pub fn is_object(&self) -> bool

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

Source§

impl<'borrow, 'tape, 'input> Value<'borrow, 'tape, 'input>

Source

pub fn try_get<Q>( &self, k: &Q, ) -> Result<Option<Value<'_, 'tape, 'input>>, TryTypeError>
where str: Borrow<Q> + Hash + Eq, for<'b> Cow<'b, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get a value based on a key, returns a TryTypeError if the current Value isn’t an Object, returns None if the key isn’t in the object

§Errors

if the value is not an object

Source§

impl<'borrow, 'tape, 'input> Value<'borrow, 'tape, 'input>
where 'input: 'tape,

Source

pub fn try_get_idx( &self, i: usize, ) -> Result<Option<Value<'_, 'tape, 'input>>, TryTypeError>

Tries to get a value based on n index, returns a type error if the current value isn’t an Array, returns None if the index is out of bounds

§Errors

if the requested type doesn’t match the actual type or the value is not an object

Source§

impl<'borrow, 'tape, 'input> Value<'borrow, 'tape, 'input>
where 'input: 'tape,

Source

pub fn as_array(&self) -> Option<Array<'_, 'tape, 'input>>

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

Source

pub fn as_object(&self) -> Option<Object<'_, 'tape, 'input>>

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

Source§

impl<'borrow, 'tape, 'input> Value<'borrow, 'tape, 'input>

Source

pub fn try_as_array(&self) -> Result<Array<'_, 'tape, 'input>, TryTypeError>

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

§Errors

if the requested type doesn’t match the actual type

Source

pub fn try_as_object(&self) -> Result<Object<'_, 'tape, 'input>, TryTypeError>

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

§Errors

if the requested type doesn’t match the actual type

Source§

impl<'borrow, 'tape, 'input> Value<'borrow, 'tape, 'input>

Source

pub fn get<'k, Q>(&self, k: &'k Q) -> Option<Value<'_, 'tape, 'input>>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

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.

Source

pub fn contains_key<Q>(&self, k: &Q) -> bool
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

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

Source§

impl<'borrow, 'tape, 'input> Value<'borrow, 'tape, 'input>

Source

pub fn get_idx(&self, i: usize) -> Option<Value<'_, 'tape, 'input>>

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.

Source§

impl<'borrow, 'tape, 'input> Value<'borrow, 'tape, 'input>
where 'input: 'tape,

Source

pub fn get_bool<Q>(&self, k: &Q) -> Option<bool>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a bool

Source

pub fn get_i128<Q>(&self, k: &Q) -> Option<i128>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a i128

Source

pub fn get_i64<Q>(&self, k: &Q) -> Option<i64>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a i64

Source

pub fn get_i32<Q>(&self, k: &Q) -> Option<i32>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a i32

Source

pub fn get_i16<Q>(&self, k: &Q) -> Option<i16>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a i16

Source

pub fn get_i8<Q>(&self, k: &Q) -> Option<i8>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a i8

Source

pub fn get_u128<Q>(&self, k: &Q) -> Option<u128>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a u128

Source

pub fn get_u64<Q>(&self, k: &Q) -> Option<u64>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a u64

Source

pub fn get_usize<Q>(&self, k: &Q) -> Option<usize>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a usize

Source

pub fn get_u32<Q>(&self, k: &Q) -> Option<u32>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a u32

Source

pub fn get_u16<Q>(&self, k: &Q) -> Option<u16>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a u16

Source

pub fn get_u8<Q>(&self, k: &Q) -> Option<u8>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a u8

Source

pub fn get_f64<Q>(&self, k: &Q) -> Option<f64>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a f64

Source

pub fn get_f32<Q>(&self, k: &Q) -> Option<f32>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a f32

Source

pub fn get_str<Q>(&self, k: &Q) -> Option<&str>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a str

Source§

impl<'borrow, 'tape, 'input> Value<'borrow, 'tape, 'input>

Source

pub fn get_array<Q>(&self, k: &Q) -> Option<Array<'_, 'tape, 'input>>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a array

Source

pub fn get_object<Q>(&self, k: &Q) -> Option<Object<'_, 'tape, 'input>>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a object

Source§

impl<'borrow, 'tape, 'input> Value<'borrow, 'tape, 'input>

Source

pub fn try_get_array<Q>( &self, k: &Q, ) -> Result<Option<Array<'_, 'tape, 'input>>, TryTypeError>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as an array, returns an error if it isn’t a array

§Errors

if the requested type doesn’t match the actual type or the value is not an object

Source

pub fn try_get_object<Q>( &self, k: &Q, ) -> Result<Option<Object<'_, 'tape, 'input>>, TryTypeError>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as an object, returns an error if it isn’t an object

§Errors

if the requested type doesn’t match the actual type or the value is not an object

Source§

impl<'borrow, 'tape, 'input> Value<'borrow, 'tape, 'input>

Source

pub fn try_get_bool<Q>(&self, k: &Q) -> Result<Option<bool>, TryTypeError>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a bool, returns an error if it isn’t bool

§Errors

if the requested type doesn’t match the actual type or the value is not an object

Source

pub fn try_get_i128<Q>(&self, k: &Q) -> Result<Option<i128>, TryTypeError>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a i128, returns an error if it isn’t i128

§Errors

if the requested type doesn’t match the actual type or the value is not an object

Source

pub fn try_get_i64<Q>(&self, k: &Q) -> Result<Option<i64>, TryTypeError>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a i64, returns an error if it isn’t a i64

§Errors

if the requested type doesn’t match the actual type or the value is not an object

Source

pub fn try_get_i32<Q>(&self, k: &Q) -> Result<Option<i32>, TryTypeError>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a i32, returns an error if it isn’t a i32

§Errors

if the requested type doesn’t match the actual type or the value is not an object

Source

pub fn try_get_i16<Q>(&self, k: &Q) -> Result<Option<i16>, TryTypeError>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a i16, returns an error if it isn’t a i16

§Errors

if the requested type doesn’t match the actual type or the value is not an object

Source

pub fn try_get_i8<Q>(&self, k: &Q) -> Result<Option<i8>, TryTypeError>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a u128, returns an error if it isn’t a u128

§Errors

if the requested type doesn’t match the actual type or the value is not an object

Source

pub fn try_get_u128<Q>(&self, k: &Q) -> Result<Option<u128>, TryTypeError>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a u64, returns an error if it isn’t a u64

§Errors

if the requested type doesn’t match the actual type or the value is not an object

Source

pub fn try_get_u64<Q>(&self, k: &Q) -> Result<Option<u64>, TryTypeError>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a usize, returns an error if it isn’t a usize

§Errors

if the requested type doesn’t match the actual type or the value is not an object

Source

pub fn try_get_usize<Q>(&self, k: &Q) -> Result<Option<usize>, TryTypeError>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a u32, returns an error if it isn’t a u32

§Errors

if the requested type doesn’t match the actual type or the value is not an object

Source

pub fn try_get_u32<Q>(&self, k: &Q) -> Result<Option<u32>, TryTypeError>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a u16, returns an error if it isn’t a u16

§Errors

if the requested type doesn’t match the actual type or the value is not an object

Source

pub fn try_get_u16<Q>(&self, k: &Q) -> Result<Option<u16>, TryTypeError>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a u8, returns an error if it isn’t a u8

§Errors

if the requested type doesn’t match the actual type or the value is not an object

Source

pub fn try_get_u8<Q>(&self, k: &Q) -> Result<Option<u8>, TryTypeError>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a u8, returns an error if it isn’t a u8

§Errors

if the requested type doesn’t match the actual type or the value is not an object

Source

pub fn try_get_f64<Q>(&self, k: &Q) -> Result<Option<f64>, TryTypeError>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a f64, returns an error if it isn’t a f64

§Errors

if the requested type doesn’t match the actual type or the value is not an object

Source

pub fn try_get_f32<Q>(&self, k: &Q) -> Result<Option<f32>, TryTypeError>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a f32, returns an error if it isn’t a f32

§Errors

if the requested type doesn’t match the actual type or the value is not an object

Source

pub fn try_get_str<Q>(&self, k: &Q) -> Result<Option<&str>, TryTypeError>
where str: Borrow<Q>, for<'a> Cow<'a, str>: Borrow<Q>, Q: ?Sized + Hash + Eq + Ord,

Tries to get an element of an object as a str, returns an error if it isn’t a str

§Errors

if the requested type doesn’t match the actual type or the value is not an object

Source§

impl<'borrow, 'tape, 'input> Value<'borrow, 'tape, 'input>

Source

pub fn into_value(self) -> Value<'input>

turns the lazy value into a borrowed value

Source

pub fn into_owned<'snot>(self) -> Value<'snot, 'tape, 'input>

extends the Value COW is owned

Source

pub fn is_tape(&self) -> bool

returns true when the current representation is a tape

Source

pub fn is_value(&self) -> bool

returns true when the current representation is a borrowed value this is the opposite of is_tape

Source

pub fn from_tape(tape: Value<'tape, 'input>) -> Self

Creates a new lazy Value from a tape

Trait Implementations§

Source§

impl<'borrow, 'tape, 'input> Clone for Value<'borrow, 'tape, 'input>

Source§

fn clone(&self) -> Value<'borrow, 'tape, 'input>

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<'borrow, 'tape, 'input> Debug for Value<'borrow, 'tape, 'input>

Source§

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

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

impl Default for Value<'static, 'static, '_>

Source§

fn default() -> Self

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

impl<'borrow, 'tape, 'value> Display for Value<'borrow, 'tape, 'value>

Source§

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

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

impl<'borrow, 'tape, 'value> From<&'value str> for Value<'borrow, 'tape, 'value>

Source§

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

Converts to this type from the input type.
Source§

impl<'borrow, 'tape, 'value> From<()> for Value<'borrow, 'tape, 'value>

Source§

fn from(v: ()) -> Self

Converts to this type from the input type.
Source§

impl<'borrow, 'tape, 'value> From<Cow<'value, str>> for Value<'borrow, 'tape, 'value>

Source§

fn from(v: Cow<'value, str>) -> Self

Converts to this type from the input type.
Source§

impl<'borrow, 'tape, 'value, T> From<Option<T>> for Value<'borrow, 'tape, 'value>
where Value<'value>: From<Option<T>>,

Source§

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

Converts to this type from the input type.
Source§

impl<'borrow, 'tape, 'value> From<SizedHashMap<Cow<'value, str>, Value<'value>>> for Value<'borrow, 'tape, 'value>

Source§

fn from(v: Object<'value>) -> Self

Converts to this type from the input type.
Source§

impl<'borrow, 'tape, 'value> From<StaticNode> for Value<'borrow, 'tape, 'value>

Source§

fn from(v: StaticNode) -> Self

Converts to this type from the input type.
Source§

impl<'borrow, 'tape, 'value> From<String> for Value<'borrow, 'tape, 'value>

Source§

fn from(v: String) -> Self

Converts to this type from the input type.
Source§

impl<'borrow, 'tape, 'value> From<Value<'value>> for Value<'borrow, 'tape, 'value>

Source§

fn from(v: Value<'value>) -> Self

Converts to this type from the input type.
Source§

impl<'borrow, 'tape, 'value, S> From<Vec<S>> for Value<'borrow, 'tape, 'value>
where Value<'value>: From<Vec<S>>,

Source§

fn from(v: Vec<S>) -> Self

Converts to this type from the input type.
Source§

impl<'borrow, 'tape, 'value> From<bool> for Value<'borrow, 'tape, 'value>

Source§

fn from(v: bool) -> Self

Converts to this type from the input type.
Source§

impl<'borrow, 'tape, 'value> From<f32> for Value<'borrow, 'tape, 'value>

Source§

fn from(v: f32) -> Self

Converts to this type from the input type.
Source§

impl<'borrow, 'tape, 'value> From<f64> for Value<'borrow, 'tape, 'value>

Source§

fn from(v: f64) -> Self

Converts to this type from the input type.
Source§

impl<'borrow, 'tape, 'value> From<i16> for Value<'borrow, 'tape, 'value>

Source§

fn from(v: i16) -> Self

Converts to this type from the input type.
Source§

impl<'borrow, 'tape, 'value> From<i32> for Value<'borrow, 'tape, 'value>

Source§

fn from(v: i32) -> Self

Converts to this type from the input type.
Source§

impl<'borrow, 'tape, 'value> From<i64> for Value<'borrow, 'tape, 'value>

Source§

fn from(v: i64) -> Self

Converts to this type from the input type.
Source§

impl<'borrow, 'tape, 'value> From<i8> for Value<'borrow, 'tape, 'value>

Source§

fn from(v: i8) -> Self

Converts to this type from the input type.
Source§

impl<'borrow, 'tape, 'value> From<u16> for Value<'borrow, 'tape, 'value>

Source§

fn from(v: u16) -> Self

Converts to this type from the input type.
Source§

impl<'borrow, 'tape, 'value> From<u32> for Value<'borrow, 'tape, 'value>

Source§

fn from(v: u32) -> Self

Converts to this type from the input type.
Source§

impl<'borrow, 'tape, 'value> From<u64> for Value<'borrow, 'tape, 'value>

Source§

fn from(v: u64) -> Self

Converts to this type from the input type.
Source§

impl<'borrow, 'tape, 'value> From<u8> for Value<'borrow, 'tape, 'value>

Source§

fn from(v: u8) -> Self

Converts to this type from the input type.
Source§

impl<'borrow, 'tape, 'value> From<usize> for Value<'borrow, 'tape, 'value>

Source§

fn from(v: usize) -> Self

Converts to this type from the input type.
Source§

impl<'borrow, 'tape, 'value, K: Into<Cow<'value, str>>, V: Into<Value<'value>>> FromIterator<(K, V)> for Value<'borrow, 'tape, 'value>

Source§

fn from_iter<I: IntoIterator<Item = (K, V)>>(v: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<'borrow, 'tape, 'value, V: Into<Value<'value>>> FromIterator<V> for Value<'borrow, 'tape, 'value>

Source§

fn from_iter<I: IntoIterator<Item = V>>(v: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<'borrow, 'tape, 'input> PartialEq<&str> for Value<'borrow, 'tape, 'input>

Source§

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

Tests for self and other values to be equal, and is used by ==.
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<'borrow, 'tape, 'input> PartialEq<()> for Value<'borrow, 'tape, 'input>

Source§

fn eq(&self, _other: &()) -> bool

Tests for self and other values to be equal, and is used by ==.
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<'borrow, 'tape, 'input, K, T, S> PartialEq<HashMap<K, T, S>> for Value<'borrow, 'tape, 'input>
where K: Borrow<str> + Hash + Eq, for<'b, 't, 'i> T: PartialEq<Value<'b, 't, 'i>>, S: BuildHasher,

Source§

fn eq(&self, other: &HashMap<K, T, S>) -> bool

Tests for self and other values to be equal, and is used by ==.
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<'borrow, 'tape, 'input> PartialEq<String> for Value<'borrow, 'tape, 'input>

Source§

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

Tests for self and other values to be equal, and is used by ==.
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<'borrow, 'tape, 'input> PartialEq<bool> for Value<'borrow, 'tape, 'input>

Source§

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

Tests for self and other values to be equal, and is used by ==.
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<'borrow, 'tape, 'input> PartialEq<f32> for Value<'borrow, 'tape, 'input>

Source§

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

Tests for self and other values to be equal, and is used by ==.
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<'borrow, 'tape, 'input> PartialEq<f64> for Value<'borrow, 'tape, 'input>

Source§

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

Tests for self and other values to be equal, and is used by ==.
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<'borrow, 'tape, 'input> PartialEq<i128> for Value<'borrow, 'tape, 'input>

Source§

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

Tests for self and other values to be equal, and is used by ==.
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<'borrow, 'tape, 'input> PartialEq<i16> for Value<'borrow, 'tape, 'input>

Source§

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

Tests for self and other values to be equal, and is used by ==.
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<'borrow, 'tape, 'input> PartialEq<i32> for Value<'borrow, 'tape, 'input>

Source§

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

Tests for self and other values to be equal, and is used by ==.
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<'borrow, 'tape, 'input> PartialEq<i64> for Value<'borrow, 'tape, 'input>

Source§

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

Tests for self and other values to be equal, and is used by ==.
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<'borrow, 'tape, 'input> PartialEq<i8> for Value<'borrow, 'tape, 'input>

Source§

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

Tests for self and other values to be equal, and is used by ==.
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<'borrow, 'tape, 'input> PartialEq<str> for Value<'borrow, 'tape, 'input>

Source§

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

Tests for self and other values to be equal, and is used by ==.
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<'borrow, 'tape, 'input> PartialEq<u128> for Value<'borrow, 'tape, 'input>

Source§

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

Tests for self and other values to be equal, and is used by ==.
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<'borrow, 'tape, 'input> PartialEq<u16> for Value<'borrow, 'tape, 'input>

Source§

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

Tests for self and other values to be equal, and is used by ==.
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<'borrow, 'tape, 'input> PartialEq<u32> for Value<'borrow, 'tape, 'input>

Source§

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

Tests for self and other values to be equal, and is used by ==.
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<'borrow, 'tape, 'input> PartialEq<u64> for Value<'borrow, 'tape, 'input>

Source§

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

Tests for self and other values to be equal, and is used by ==.
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<'borrow, 'tape, 'input> PartialEq<u8> for Value<'borrow, 'tape, 'input>

Source§

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

Tests for self and other values to be equal, and is used by ==.
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<'borrow, 'tape, 'input> PartialEq<usize> for Value<'borrow, 'tape, 'input>

Source§

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

Tests for self and other values to be equal, and is used by ==.
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<'borrow, 'tape, 'input> PartialEq for Value<'borrow, 'tape, 'input>

Source§

fn eq(&self, other: &Value<'borrow, 'tape, 'input>) -> bool

Tests for self and other values to be equal, and is used by ==.
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<'borrow, 'tape, 'input> TypedValue for Value<'borrow, 'tape, 'input>

Source§

fn value_type(&self) -> ValueType

Gets the type of the current value
Source§

impl<'borrow, 'tape, 'input> ValueAsMutArray for Value<'borrow, 'tape, 'input>

Source§

type Array = Vec<Value<'input>>

The type for Arrays
Source§

fn as_array_mut(&mut self) -> Option<&mut Vec<Value<'input>>>

Tries to represent the value as an array and returns a mutable reference to it
Source§

impl<'borrow, 'tape, 'input> ValueAsMutObject for Value<'borrow, 'tape, 'input>

Source§

type Object = SizedHashMap<Cow<'input, str>, Value<'input>>

The type for Objects
Source§

fn as_object_mut(&mut self) -> Option<&mut Object<'input>>

Tries to represent the value as an object and returns a mutable reference to it
Source§

impl<'borrow, 'tape, 'value> ValueAsScalar for Value<'borrow, 'tape, 'value>

Source§

fn as_null(&self) -> Option<()>

Tries to represent the value as a ‘null’;
Source§

fn as_bool(&self) -> Option<bool>

Tries to represent the value as a bool
Source§

fn as_i64(&self) -> Option<i64>

Tries to represent the value as an i64
Source§

fn as_i128(&self) -> Option<i128>

Tries to represent the value as an i128
Source§

fn as_u64(&self) -> Option<u64>

Tries to represent the value as an u64
Source§

fn as_u128(&self) -> Option<u128>

Tries to represent the value as an u128
Source§

fn as_f64(&self) -> Option<f64>

Tries to represent the value as a f64
Source§

fn cast_f64(&self) -> Option<f64>

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

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

Tries to represent the value as a &str
Source§

fn as_i32(&self) -> Option<i32>

Tries to represent the value as an i32
Source§

fn as_i16(&self) -> Option<i16>

Tries to represent the value as an i16
Source§

fn as_i8(&self) -> Option<i8>

Tries to represent the value as an i8
Source§

fn as_usize(&self) -> Option<usize>

Tries to represent the value as an usize
Source§

fn as_u32(&self) -> Option<u32>

Tries to represent the value as an u32
Source§

fn as_u16(&self) -> Option<u16>

Tries to represent the value as an u16
Source§

fn as_u8(&self) -> Option<u8>

Tries to represent the value as an u8
Source§

fn as_f32(&self) -> Option<f32>

Tries to represent the value as a f32
Source§

fn as_char(&self) -> Option<char>

Tries to represent the value as a Char
Source§

impl<'value> ValueBuilder<'value> for Value<'static, 'static, 'value>

Source§

fn null() -> Self

Returns anull value
Source§

fn array_with_capacity(capacity: usize) -> Self

Returns an empty array with a given capacity
Source§

fn object_with_capacity(capacity: usize) -> Self

Returns an empty object with a given capacity
Source§

fn array() -> Self

Returns an empty array
Source§

fn object() -> Self

Returns an empty object
Source§

impl<'borrow, 'tape, 'value> ValueIntoString for Value<'borrow, 'tape, 'value>

Source§

type String = Cow<'value, str>

The type for Strings
Source§

fn into_string(self) -> Option<<Self as ValueIntoString>::String>

Tries to turn the value into it’s string representation
Source§

impl<'borrow, 'tape, 'input> Writable for Value<'borrow, 'tape, 'input>

Source§

fn encode(&self) -> String

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

fn encode_pp(&self) -> String

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

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

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

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

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

impl<'borrow, 'tape, 'input> StructuralPartialEq for Value<'borrow, 'tape, 'input>

Auto Trait Implementations§

§

impl<'borrow, 'tape, 'input> Freeze for Value<'borrow, 'tape, 'input>

§

impl<'borrow, 'tape, 'input> RefUnwindSafe for Value<'borrow, 'tape, 'input>

§

impl<'borrow, 'tape, 'input> Send for Value<'borrow, 'tape, 'input>

§

impl<'borrow, 'tape, 'input> Sync for Value<'borrow, 'tape, 'input>

§

impl<'borrow, 'tape, 'input> Unpin for Value<'borrow, 'tape, 'input>

§

impl<'borrow, 'tape, 'input> UnwindSafe for Value<'borrow, 'tape, 'input>

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> CloneToUninit for T
where T: Clone,

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
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> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<T> TypedScalarValue for T
where T: ValueAsScalar,

Source§

fn is_null(&self) -> bool

returns true if the current value is null
Source§

fn is_float(&self) -> bool

returns true if the current value a floatingpoint number
Source§

fn is_integer(&self) -> bool

returns true if the current value a integer number
Source§

fn is_number(&self) -> bool

returns true if the current value a number either float or intege
Source§

fn is_bool(&self) -> bool

returns true if the current value a bool
Source§

fn is_i128(&self) -> bool

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

fn is_i64(&self) -> bool

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

fn is_i32(&self) -> bool

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

fn is_i16(&self) -> bool

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

fn is_i8(&self) -> bool

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

fn is_u128(&self) -> bool

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

fn is_u64(&self) -> bool

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

fn is_usize(&self) -> bool

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

fn is_u32(&self) -> bool

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

fn is_u16(&self) -> bool

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

fn is_u8(&self) -> bool

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

fn is_f64(&self) -> bool

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

fn is_f64_castable(&self) -> bool

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

fn is_f32(&self) -> bool

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

fn is_str(&self) -> bool

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

fn is_char(&self) -> bool

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

impl<T> ValueTryAsMutObject for T

Source§

type Object = <T as ValueAsMutObject>::Object

The type for Objects
Source§

fn try_as_object_mut( &mut self, ) -> Result<&mut <T as ValueTryAsMutObject>::Object, TryTypeError>

Tries to represent the value as an object and returns a mutable reference to it Read more
Source§

impl<T> ValueTryAsScalar for T

Source§

fn try_as_bool(&self) -> Result<bool, TryTypeError>

Tries to represent the value as a bool Read more
Source§

fn try_as_i128(&self) -> Result<i128, TryTypeError>

Tries to represent the value as a i128 Read more
Source§

fn try_as_i64(&self) -> Result<i64, TryTypeError>

Tries to represent the value as an i64 Read more
Source§

fn try_as_i32(&self) -> Result<i32, TryTypeError>

Tries to represent the value as an i32 Read more
Source§

fn try_as_i16(&self) -> Result<i16, TryTypeError>

Tries to represent the value as an i16 Read more
Source§

fn try_as_i8(&self) -> Result<i8, TryTypeError>

Tries to represent the value as an i8 Read more
Source§

fn try_as_u128(&self) -> Result<u128, TryTypeError>

Tries to represent the value as an u128 Read more
Source§

fn try_as_u64(&self) -> Result<u64, TryTypeError>

Tries to represent the value as an u64 Read more
Source§

fn try_as_usize(&self) -> Result<usize, TryTypeError>

Tries to represent the value as an usize Read more
Source§

fn try_as_u32(&self) -> Result<u32, TryTypeError>

Tries to represent the value as an u32 Read more
Source§

fn try_as_u16(&self) -> Result<u16, TryTypeError>

Tries to represent the value as an u16 Read more
Source§

fn try_as_u8(&self) -> Result<u8, TryTypeError>

Tries to represent the value as an u8 Read more
Source§

fn try_as_f64(&self) -> Result<f64, TryTypeError>

Tries to represent the value as a f64 Read more
Source§

fn try_cast_f64(&self) -> Result<f64, TryTypeError>

Tries to Casts the current value to a f64 if possible, this will turn integer values into floats and error if it isn’t possible Read more
Source§

fn try_as_f32(&self) -> Result<f32, TryTypeError>

Tries to represent the value as a f32 Read more
Source§

fn try_as_str(&self) -> Result<&str, TryTypeError>

Tries to represent the value as a &str Read more
Source§

fn try_as_char(&self) -> Result<char, TryTypeError>

Tries to represent the value as a Char Read more
Source§

impl<T> ValueTryIntoString for T

Source§

type String = <T as ValueIntoString>::String

The type for Strings
Source§

fn try_into_string( self, ) -> Result<<T as ValueTryIntoString>::String, TryTypeError>

Tries to turn the value into it’s string representation Read more