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§
Implementations§
source§impl<'borrow, 'tape, 'input> Value<'borrow, 'tape, 'input>
impl<'borrow, 'tape, 'input> Value<'borrow, 'tape, 'input>
source§impl<'borrow, 'tape, 'input> Value<'borrow, 'tape, 'input>where
'input: 'tape,
impl<'borrow, 'tape, 'input> Value<'borrow, 'tape, 'input>where
'input: 'tape,
sourcepub fn try_get_idx(
&self,
i: usize,
) -> Result<Option<Value<'_, 'tape, 'input>>, TryTypeError>
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>
impl<'borrow, 'tape, 'input> Value<'borrow, 'tape, 'input>
sourcepub fn try_as_array(&self) -> Result<Array<'_, 'tape, 'input>, TryTypeError>
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
sourcepub fn try_as_object(&self) -> Result<Object<'_, 'tape, 'input>, TryTypeError>
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>
impl<'borrow, 'tape, 'input> Value<'borrow, 'tape, 'input>
source§impl<'borrow, 'tape, 'input> Value<'borrow, 'tape, 'input>where
'input: 'tape,
impl<'borrow, 'tape, 'input> Value<'borrow, 'tape, 'input>where
'input: 'tape,
sourcepub fn get_bool<Q>(&self, k: &Q) -> Option<bool>
pub fn get_bool<Q>(&self, k: &Q) -> Option<bool>
Tries to get an element of an object as a bool
sourcepub fn get_i128<Q>(&self, k: &Q) -> Option<i128>
pub fn get_i128<Q>(&self, k: &Q) -> Option<i128>
Tries to get an element of an object as a i128
sourcepub fn get_u128<Q>(&self, k: &Q) -> Option<u128>
pub fn get_u128<Q>(&self, k: &Q) -> Option<u128>
Tries to get an element of an object as a u128
sourcepub fn get_usize<Q>(&self, k: &Q) -> Option<usize>
pub fn get_usize<Q>(&self, k: &Q) -> Option<usize>
Tries to get an element of an object as a usize
source§impl<'borrow, 'tape, 'input> Value<'borrow, 'tape, 'input>
impl<'borrow, 'tape, 'input> Value<'borrow, 'tape, 'input>
source§impl<'borrow, 'tape, 'input> Value<'borrow, 'tape, 'input>
impl<'borrow, 'tape, 'input> Value<'borrow, 'tape, 'input>
sourcepub fn try_get_array<Q>(
&self,
k: &Q,
) -> Result<Option<Array<'_, 'tape, 'input>>, TryTypeError>
pub fn try_get_array<Q>( &self, k: &Q, ) -> Result<Option<Array<'_, 'tape, 'input>>, TryTypeError>
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
sourcepub fn try_get_object<Q>(
&self,
k: &Q,
) -> Result<Option<Object<'_, 'tape, 'input>>, TryTypeError>
pub fn try_get_object<Q>( &self, k: &Q, ) -> Result<Option<Object<'_, 'tape, 'input>>, TryTypeError>
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>
impl<'borrow, 'tape, 'input> Value<'borrow, 'tape, 'input>
sourcepub fn try_get_bool<Q>(&self, k: &Q) -> Result<Option<bool>, TryTypeError>
pub fn try_get_bool<Q>(&self, k: &Q) -> Result<Option<bool>, TryTypeError>
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
sourcepub fn try_get_i128<Q>(&self, k: &Q) -> Result<Option<i128>, TryTypeError>
pub fn try_get_i128<Q>(&self, k: &Q) -> Result<Option<i128>, TryTypeError>
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
sourcepub fn try_get_i64<Q>(&self, k: &Q) -> Result<Option<i64>, TryTypeError>
pub fn try_get_i64<Q>(&self, k: &Q) -> Result<Option<i64>, TryTypeError>
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
sourcepub fn try_get_i32<Q>(&self, k: &Q) -> Result<Option<i32>, TryTypeError>
pub fn try_get_i32<Q>(&self, k: &Q) -> Result<Option<i32>, TryTypeError>
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
sourcepub fn try_get_i16<Q>(&self, k: &Q) -> Result<Option<i16>, TryTypeError>
pub fn try_get_i16<Q>(&self, k: &Q) -> Result<Option<i16>, TryTypeError>
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
sourcepub fn try_get_i8<Q>(&self, k: &Q) -> Result<Option<i8>, TryTypeError>
pub fn try_get_i8<Q>(&self, k: &Q) -> Result<Option<i8>, TryTypeError>
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
sourcepub fn try_get_u128<Q>(&self, k: &Q) -> Result<Option<u128>, TryTypeError>
pub fn try_get_u128<Q>(&self, k: &Q) -> Result<Option<u128>, TryTypeError>
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
sourcepub fn try_get_u64<Q>(&self, k: &Q) -> Result<Option<u64>, TryTypeError>
pub fn try_get_u64<Q>(&self, k: &Q) -> Result<Option<u64>, TryTypeError>
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
sourcepub fn try_get_usize<Q>(&self, k: &Q) -> Result<Option<usize>, TryTypeError>
pub fn try_get_usize<Q>(&self, k: &Q) -> Result<Option<usize>, TryTypeError>
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
sourcepub fn try_get_u32<Q>(&self, k: &Q) -> Result<Option<u32>, TryTypeError>
pub fn try_get_u32<Q>(&self, k: &Q) -> Result<Option<u32>, TryTypeError>
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
sourcepub fn try_get_u16<Q>(&self, k: &Q) -> Result<Option<u16>, TryTypeError>
pub fn try_get_u16<Q>(&self, k: &Q) -> Result<Option<u16>, TryTypeError>
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
sourcepub fn try_get_u8<Q>(&self, k: &Q) -> Result<Option<u8>, TryTypeError>
pub fn try_get_u8<Q>(&self, k: &Q) -> Result<Option<u8>, TryTypeError>
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
sourcepub fn try_get_f64<Q>(&self, k: &Q) -> Result<Option<f64>, TryTypeError>
pub fn try_get_f64<Q>(&self, k: &Q) -> Result<Option<f64>, TryTypeError>
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
sourcepub fn try_get_f32<Q>(&self, k: &Q) -> Result<Option<f32>, TryTypeError>
pub fn try_get_f32<Q>(&self, k: &Q) -> Result<Option<f32>, TryTypeError>
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
sourcepub fn try_get_str<Q>(&self, k: &Q) -> Result<Option<&str>, TryTypeError>
pub fn try_get_str<Q>(&self, k: &Q) -> Result<Option<&str>, TryTypeError>
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>
impl<'borrow, 'tape, 'input> Value<'borrow, 'tape, 'input>
sourcepub fn into_value(self) -> Value<'input>
pub fn into_value(self) -> Value<'input>
turns the lazy value into a borrowed value
sourcepub fn into_owned<'snot>(self) -> Value<'snot, 'tape, 'input>
pub fn into_owned<'snot>(self) -> Value<'snot, 'tape, 'input>
extends the Value COW is owned
Trait Implementations§
source§impl<'borrow, 'tape, 'value> From<SizedHashMap<Cow<'value, str>, Value<'value>>> for Value<'borrow, 'tape, 'value>
impl<'borrow, 'tape, 'value> From<SizedHashMap<Cow<'value, str>, Value<'value>>> for Value<'borrow, 'tape, 'value>
source§impl<'borrow, 'tape, 'value> From<StaticNode> for Value<'borrow, 'tape, 'value>
impl<'borrow, 'tape, 'value> From<StaticNode> for Value<'borrow, 'tape, 'value>
source§fn from(v: StaticNode) -> Self
fn from(v: StaticNode) -> Self
source§impl<'borrow, 'tape, 'value, K: Into<Cow<'value, str>>, V: Into<Value<'value>>> FromIterator<(K, V)> for Value<'borrow, 'tape, 'value>
impl<'borrow, 'tape, 'value, K: Into<Cow<'value, str>>, V: Into<Value<'value>>> FromIterator<(K, V)> for Value<'borrow, 'tape, 'value>
source§impl<'borrow, 'tape, 'value, V: Into<Value<'value>>> FromIterator<V> for Value<'borrow, 'tape, 'value>
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
fn from_iter<I: IntoIterator<Item = V>>(v: I) -> Self
source§impl<'borrow, 'tape, 'input, K, T, S> PartialEq<HashMap<K, T, S>> for Value<'borrow, 'tape, 'input>
impl<'borrow, 'tape, 'input, K, T, S> PartialEq<HashMap<K, T, S>> for Value<'borrow, 'tape, 'input>
source§impl<'borrow, 'tape, 'input> PartialEq for Value<'borrow, 'tape, 'input>
impl<'borrow, 'tape, 'input> PartialEq for Value<'borrow, 'tape, 'input>
source§impl<'borrow, 'tape, 'input> TypedValue for Value<'borrow, 'tape, 'input>
impl<'borrow, 'tape, 'input> TypedValue for Value<'borrow, 'tape, 'input>
source§fn value_type(&self) -> ValueType
fn value_type(&self) -> ValueType
source§impl<'borrow, 'tape, 'input> ValueAsMutArray for Value<'borrow, 'tape, 'input>
impl<'borrow, 'tape, 'input> ValueAsMutArray for Value<'borrow, 'tape, 'input>
source§impl<'borrow, 'tape, 'input> ValueAsMutObject for Value<'borrow, 'tape, 'input>
impl<'borrow, 'tape, 'input> ValueAsMutObject for Value<'borrow, 'tape, 'input>
source§impl<'borrow, 'tape, 'value> ValueAsScalar for Value<'borrow, 'tape, 'value>
impl<'borrow, 'tape, 'value> ValueAsScalar for Value<'borrow, 'tape, 'value>
source§impl<'value> ValueBuilder<'value> for Value<'static, 'static, 'value>
impl<'value> ValueBuilder<'value> for Value<'static, 'static, 'value>
source§fn array_with_capacity(capacity: usize) -> Self
fn array_with_capacity(capacity: usize) -> Self
source§fn object_with_capacity(capacity: usize) -> Self
fn object_with_capacity(capacity: usize) -> Self
source§impl<'borrow, 'tape, 'value> ValueIntoString for Value<'borrow, 'tape, 'value>
impl<'borrow, 'tape, 'value> ValueIntoString for Value<'borrow, 'tape, 'value>
source§impl<'borrow, 'tape, 'input> Writable for Value<'borrow, 'tape, 'input>
impl<'borrow, 'tape, 'input> Writable for Value<'borrow, 'tape, 'input>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)