pub struct Value<'tape, 'input>(/* private fields */)
where
'input: 'tape;
Expand description
Wrapper around the tape that allows interaction via a Value
-like API.
Implementations§
Source§impl<'tape, 'input> Value<'tape, 'input>
impl<'tape, 'input> Value<'tape, 'input>
Source§impl<'tape, 'input> Value<'tape, 'input>where
'input: 'tape,
impl<'tape, 'input> Value<'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<'tape, 'input> Value<'tape, 'input>
impl<'tape, 'input> Value<'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<'tape, 'input> Value<'tape, 'input>
impl<'tape, 'input> Value<'tape, 'input>
Sourcepub fn get<Q>(&self, k: &Q) -> Option<Value<'tape, 'input>>
pub fn get<Q>(&self, k: &Q) -> Option<Value<'tape, 'input>>
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.
Sourcepub fn contains_key(&self, k: &str) -> bool
pub fn contains_key(&self, k: &str) -> bool
Checks if a Value contains a given key. This will return flase if Value isn’t an object
Source§impl<'tape, 'input> Value<'tape, 'input>
impl<'tape, 'input> Value<'tape, 'input>
Source§impl<'tape, 'input> Value<'tape, 'input>
impl<'tape, 'input> Value<'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
Trait Implementations§
Source§impl<'tape, 'input> TypedValue for Value<'tape, 'input>
impl<'tape, 'input> TypedValue for Value<'tape, 'input>
Source§fn value_type(&self) -> ValueType
fn value_type(&self) -> ValueType
Source§impl<'tape, 'input> ValueAsScalar for Value<'tape, 'input>where
'input: 'tape,
impl<'tape, 'input> ValueAsScalar for Value<'tape, 'input>where
'input: 'tape,
Source§impl<'tape, 'input> ValueIntoArray for Value<'tape, 'input>
impl<'tape, 'input> ValueIntoArray for Value<'tape, 'input>
Source§impl<'tape, 'input> ValueIntoObject for Value<'tape, 'input>
impl<'tape, 'input> ValueIntoObject for Value<'tape, 'input>
Source§impl<'tape, 'input> ValueIntoString for Value<'tape, 'input>
impl<'tape, 'input> ValueIntoString for Value<'tape, 'input>
Source§impl<'tape, 'input> ValueObjectAccessAsScalar for Value<'tape, 'input>where
'input: 'tape,
impl<'tape, 'input> ValueObjectAccessAsScalar for Value<'tape, 'input>where
'input: 'tape,
Source§fn get_usize<Q>(&self, k: &Q) -> Option<usize>
fn get_usize<Q>(&self, k: &Q) -> Option<usize>
Source§impl<'tape, 'input> ValueObjectAccessTryAsScalar for Value<'tape, 'input>
impl<'tape, 'input> ValueObjectAccessTryAsScalar for Value<'tape, 'input>
Source§fn try_get_bool<Q>(&self, k: &Q) -> Result<Option<bool>, TryTypeError>
fn try_get_bool<Q>(&self, k: &Q) -> Result<Option<bool>, TryTypeError>
Source§fn try_get_i128<Q>(&self, k: &Q) -> Result<Option<i128>, TryTypeError>
fn try_get_i128<Q>(&self, k: &Q) -> Result<Option<i128>, TryTypeError>
Source§fn try_get_i64<Q>(&self, k: &Q) -> Result<Option<i64>, TryTypeError>
fn try_get_i64<Q>(&self, k: &Q) -> Result<Option<i64>, TryTypeError>
Source§fn try_get_i32<Q>(&self, k: &Q) -> Result<Option<i32>, TryTypeError>
fn try_get_i32<Q>(&self, k: &Q) -> Result<Option<i32>, TryTypeError>
Source§fn try_get_i16<Q>(&self, k: &Q) -> Result<Option<i16>, TryTypeError>
fn try_get_i16<Q>(&self, k: &Q) -> Result<Option<i16>, TryTypeError>
Source§fn try_get_i8<Q>(&self, k: &Q) -> Result<Option<i8>, TryTypeError>
fn try_get_i8<Q>(&self, k: &Q) -> Result<Option<i8>, TryTypeError>
Source§fn try_get_u128<Q>(&self, k: &Q) -> Result<Option<u128>, TryTypeError>
fn try_get_u128<Q>(&self, k: &Q) -> Result<Option<u128>, TryTypeError>
Source§fn try_get_u64<Q>(&self, k: &Q) -> Result<Option<u64>, TryTypeError>
fn try_get_u64<Q>(&self, k: &Q) -> Result<Option<u64>, TryTypeError>
Source§fn try_get_usize<Q>(&self, k: &Q) -> Result<Option<usize>, TryTypeError>
fn try_get_usize<Q>(&self, k: &Q) -> Result<Option<usize>, TryTypeError>
Source§fn try_get_u32<Q>(&self, k: &Q) -> Result<Option<u32>, TryTypeError>
fn try_get_u32<Q>(&self, k: &Q) -> Result<Option<u32>, TryTypeError>
Source§fn try_get_u16<Q>(&self, k: &Q) -> Result<Option<u16>, TryTypeError>
fn try_get_u16<Q>(&self, k: &Q) -> Result<Option<u16>, TryTypeError>
Source§fn try_get_u8<Q>(&self, k: &Q) -> Result<Option<u8>, TryTypeError>
fn try_get_u8<Q>(&self, k: &Q) -> Result<Option<u8>, TryTypeError>
Source§fn try_get_f64<Q>(&self, k: &Q) -> Result<Option<f64>, TryTypeError>
fn try_get_f64<Q>(&self, k: &Q) -> Result<Option<f64>, TryTypeError>
Source§fn try_get_f32<Q>(&self, k: &Q) -> Result<Option<f32>, TryTypeError>
fn try_get_f32<Q>(&self, k: &Q) -> Result<Option<f32>, TryTypeError>
Source§impl<'tape, 'input> Writable for Value<'tape, 'input>
impl<'tape, 'input> Writable for Value<'tape, 'input>
impl<'tape, 'input> Copy for Value<'tape, 'input>where
'input: 'tape,
Auto Trait Implementations§
impl<'tape, 'input> Freeze for Value<'tape, 'input>
impl<'tape, 'input> RefUnwindSafe for Value<'tape, 'input>
impl<'tape, 'input> Send for Value<'tape, 'input>
impl<'tape, 'input> Sync for Value<'tape, 'input>
impl<'tape, 'input> Unpin for Value<'tape, 'input>
impl<'tape, 'input> UnwindSafe for Value<'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§impl<T> TypedScalarValue for Twhere
T: ValueAsScalar,
impl<T> TypedScalarValue for Twhere
T: ValueAsScalar,
Source§fn is_integer(&self) -> bool
fn is_integer(&self) -> bool
Source§fn is_f64_castable(&self) -> bool
fn is_f64_castable(&self) -> bool
Source§impl<T> ValueTryAsScalar for Twhere
T: ValueAsScalar + TypedValue,
impl<T> ValueTryAsScalar for Twhere
T: ValueAsScalar + TypedValue,
Source§fn try_as_bool(&self) -> Result<bool, TryTypeError>
fn try_as_bool(&self) -> Result<bool, TryTypeError>
Source§fn try_as_i128(&self) -> Result<i128, TryTypeError>
fn try_as_i128(&self) -> Result<i128, TryTypeError>
Source§fn try_as_i64(&self) -> Result<i64, TryTypeError>
fn try_as_i64(&self) -> Result<i64, TryTypeError>
Source§fn try_as_i32(&self) -> Result<i32, TryTypeError>
fn try_as_i32(&self) -> Result<i32, TryTypeError>
Source§fn try_as_i16(&self) -> Result<i16, TryTypeError>
fn try_as_i16(&self) -> Result<i16, TryTypeError>
Source§fn try_as_i8(&self) -> Result<i8, TryTypeError>
fn try_as_i8(&self) -> Result<i8, TryTypeError>
Source§fn try_as_u128(&self) -> Result<u128, TryTypeError>
fn try_as_u128(&self) -> Result<u128, TryTypeError>
Source§fn try_as_u64(&self) -> Result<u64, TryTypeError>
fn try_as_u64(&self) -> Result<u64, TryTypeError>
Source§fn try_as_usize(&self) -> Result<usize, TryTypeError>
fn try_as_usize(&self) -> Result<usize, TryTypeError>
Source§fn try_as_u32(&self) -> Result<u32, TryTypeError>
fn try_as_u32(&self) -> Result<u32, TryTypeError>
Source§fn try_as_u16(&self) -> Result<u16, TryTypeError>
fn try_as_u16(&self) -> Result<u16, TryTypeError>
Source§fn try_as_u8(&self) -> Result<u8, TryTypeError>
fn try_as_u8(&self) -> Result<u8, TryTypeError>
Source§fn try_as_f64(&self) -> Result<f64, TryTypeError>
fn try_as_f64(&self) -> Result<f64, TryTypeError>
Source§fn try_cast_f64(&self) -> Result<f64, TryTypeError>
fn try_cast_f64(&self) -> Result<f64, TryTypeError>
Source§fn try_as_f32(&self) -> Result<f32, TryTypeError>
fn try_as_f32(&self) -> Result<f32, TryTypeError>
Source§fn try_as_str(&self) -> Result<&str, TryTypeError>
fn try_as_str(&self) -> Result<&str, TryTypeError>
Source§fn try_as_char(&self) -> Result<char, TryTypeError>
fn try_as_char(&self) -> Result<char, TryTypeError>
Source§impl<T> ValueTryIntoArray for Twhere
T: ValueIntoArray + TypedValue,
impl<T> ValueTryIntoArray for Twhere
T: ValueIntoArray + TypedValue,
Source§fn try_into_array(self) -> Result<<T as ValueTryIntoArray>::Array, TryTypeError>
fn try_into_array(self) -> Result<<T as ValueTryIntoArray>::Array, TryTypeError>
Tries to turn the value into it’s array representation
§Errors
if the requested type doesn’t match the actual type
Source§type Array = <T as ValueIntoArray>::Array
type Array = <T as ValueIntoArray>::Array
Source§impl<T> ValueTryIntoObject for Twhere
T: ValueIntoObject + TypedValue,
impl<T> ValueTryIntoObject for Twhere
T: ValueIntoObject + TypedValue,
Source§fn try_into_object(
self,
) -> Result<<T as ValueTryIntoObject>::Object, TryTypeError>
fn try_into_object( self, ) -> Result<<T as ValueTryIntoObject>::Object, TryTypeError>
Tries to turn the value into it’s object representation
§Errors
if the requested type doesn’t match the actual type