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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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