Trait simd_json::prelude::ValueTryAsScalar
source · pub trait ValueTryAsScalar {
Show 17 methods
// Required methods
fn try_as_bool(&self) -> Result<bool, TryTypeError>;
fn try_as_i128(&self) -> Result<i128, TryTypeError>;
fn try_as_i64(&self) -> Result<i64, TryTypeError>;
fn try_as_i32(&self) -> Result<i32, TryTypeError>;
fn try_as_i16(&self) -> Result<i16, TryTypeError>;
fn try_as_i8(&self) -> Result<i8, TryTypeError>;
fn try_as_u128(&self) -> Result<u128, TryTypeError>;
fn try_as_u64(&self) -> Result<u64, TryTypeError>;
fn try_as_usize(&self) -> Result<usize, TryTypeError>;
fn try_as_u32(&self) -> Result<u32, TryTypeError>;
fn try_as_u16(&self) -> Result<u16, TryTypeError>;
fn try_as_u8(&self) -> Result<u8, TryTypeError>;
fn try_as_f64(&self) -> Result<f64, TryTypeError>;
fn try_cast_f64(&self) -> Result<f64, TryTypeError>;
fn try_as_f32(&self) -> Result<f32, TryTypeError>;
fn try_as_str(&self) -> Result<&str, TryTypeError>;
fn try_as_char(&self) -> Result<char, TryTypeError>;
}
Expand description
Prelude to include needed traits
try_as_*
access to scalar value types
Required Methods§
sourcefn try_as_bool(&self) -> Result<bool, TryTypeError>
fn try_as_bool(&self) -> Result<bool, TryTypeError>
sourcefn try_as_i128(&self) -> Result<i128, TryTypeError>
fn try_as_i128(&self) -> Result<i128, TryTypeError>
sourcefn try_as_i64(&self) -> Result<i64, TryTypeError>
fn try_as_i64(&self) -> Result<i64, TryTypeError>
sourcefn try_as_i32(&self) -> Result<i32, TryTypeError>
fn try_as_i32(&self) -> Result<i32, TryTypeError>
sourcefn try_as_i16(&self) -> Result<i16, TryTypeError>
fn try_as_i16(&self) -> Result<i16, TryTypeError>
sourcefn try_as_i8(&self) -> Result<i8, TryTypeError>
fn try_as_i8(&self) -> Result<i8, TryTypeError>
sourcefn try_as_u128(&self) -> Result<u128, TryTypeError>
fn try_as_u128(&self) -> Result<u128, TryTypeError>
sourcefn try_as_u64(&self) -> Result<u64, TryTypeError>
fn try_as_u64(&self) -> Result<u64, TryTypeError>
sourcefn try_as_usize(&self) -> Result<usize, TryTypeError>
fn try_as_usize(&self) -> Result<usize, TryTypeError>
Tries to represent the value as an usize
§Errors
if the requested type doesn’t match the actual type
sourcefn try_as_u32(&self) -> Result<u32, TryTypeError>
fn try_as_u32(&self) -> Result<u32, TryTypeError>
sourcefn try_as_u16(&self) -> Result<u16, TryTypeError>
fn try_as_u16(&self) -> Result<u16, TryTypeError>
sourcefn try_as_u8(&self) -> Result<u8, TryTypeError>
fn try_as_u8(&self) -> Result<u8, TryTypeError>
sourcefn try_as_f64(&self) -> Result<f64, TryTypeError>
fn try_as_f64(&self) -> Result<f64, TryTypeError>
sourcefn try_cast_f64(&self) -> Result<f64, TryTypeError>
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
§Errors
if the requested type doesn’t match the actual type