Trait value_trait::derived::ValueArrayTryAccess
source · pub trait ValueArrayTryAccess {
type Target;
// Required method
fn try_get_idx(
&self,
i: usize
) -> Result<Option<&Self::Target>, TryTypeError>;
}
Expand description
Access to a value as an array with error handling
Required Associated Types§
Required Methods§
sourcefn try_get_idx(&self, i: usize) -> Result<Option<&Self::Target>, TryTypeError>
fn try_get_idx(&self, i: usize) -> Result<Option<&Self::Target>, 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