simd_json::base

Trait ValueAsScalar

Source
pub trait ValueAsScalar {
Show 18 methods // Required methods fn as_null(&self) -> Option<()>; fn as_bool(&self) -> Option<bool>; fn as_i64(&self) -> Option<i64>; fn as_u64(&self) -> Option<u64>; fn as_f64(&self) -> Option<f64>; fn as_str(&self) -> Option<&str>; // Provided methods fn as_i128(&self) -> Option<i128> { ... } fn as_i32(&self) -> Option<i32> { ... } fn as_i16(&self) -> Option<i16> { ... } fn as_i8(&self) -> Option<i8> { ... } fn as_u128(&self) -> Option<u128> { ... } fn as_usize(&self) -> Option<usize> { ... } fn as_u32(&self) -> Option<u32> { ... } fn as_u16(&self) -> Option<u16> { ... } fn as_u8(&self) -> Option<u8> { ... } fn as_f32(&self) -> Option<f32> { ... } fn cast_f64(&self) -> Option<f64> { ... } fn as_char(&self) -> Option<char> { ... }
}
Expand description

Access to scalar value types

Required Methods§

Source

fn as_null(&self) -> Option<()>

Tries to represent the value as a ‘null’;

Source

fn as_bool(&self) -> Option<bool>

Tries to represent the value as a bool

Source

fn as_i64(&self) -> Option<i64>

Tries to represent the value as an i64

Source

fn as_u64(&self) -> Option<u64>

Tries to represent the value as an u64

Source

fn as_f64(&self) -> Option<f64>

Tries to represent the value as a f64

Source

fn as_str(&self) -> Option<&str>

Tries to represent the value as a &str

Provided Methods§

Source

fn as_i128(&self) -> Option<i128>

Tries to represent the value as an i128

Source

fn as_i32(&self) -> Option<i32>

Tries to represent the value as an i32

Source

fn as_i16(&self) -> Option<i16>

Tries to represent the value as an i16

Source

fn as_i8(&self) -> Option<i8>

Tries to represent the value as an i8

Source

fn as_u128(&self) -> Option<u128>

Tries to represent the value as an u128

Source

fn as_usize(&self) -> Option<usize>

Tries to represent the value as an usize

Source

fn as_u32(&self) -> Option<u32>

Tries to represent the value as an u32

Source

fn as_u16(&self) -> Option<u16>

Tries to represent the value as an u16

Source

fn as_u8(&self) -> Option<u8>

Tries to represent the value as an u8

Source

fn as_f32(&self) -> Option<f32>

Tries to represent the value as a f32

Source

fn cast_f64(&self) -> Option<f64>

Casts the current value to a f64 if possible, this will turn integer values into floats.

Source

fn as_char(&self) -> Option<char>

Tries to represent the value as a Char

Implementations on Foreign Types§

Source§

impl<V> ValueAsScalar for Option<V>
where V: ValueAsScalar,

Source§

fn as_null(&self) -> Option<()>

Source§

fn as_bool(&self) -> Option<bool>

Source§

fn as_i64(&self) -> Option<i64>

Source§

fn as_u64(&self) -> Option<u64>

Source§

fn as_f64(&self) -> Option<f64>

Source§

fn as_str(&self) -> Option<&str>

Source§

impl<V> ValueAsScalar for &V
where V: ValueAsScalar,

Source§

fn as_null(&self) -> Option<()>

Source§

fn as_bool(&self) -> Option<bool>

Source§

fn as_i64(&self) -> Option<i64>

Source§

fn as_u64(&self) -> Option<u64>

Source§

fn as_f64(&self) -> Option<f64>

Source§

fn as_str(&self) -> Option<&str>

Source§

impl<V, E> ValueAsScalar for Result<V, E>
where V: ValueAsScalar,

Source§

fn as_null(&self) -> Option<()>

Source§

fn as_bool(&self) -> Option<bool>

Source§

fn as_i64(&self) -> Option<i64>

Source§

fn as_u64(&self) -> Option<u64>

Source§

fn as_f64(&self) -> Option<f64>

Source§

fn as_str(&self) -> Option<&str>

Implementors§

Source§

impl ValueAsScalar for StaticNode

Source§

impl ValueAsScalar for simd_json::owned::Value

Source§

impl<'borrow, 'tape, 'value> ValueAsScalar for simd_json::lazy::Value<'borrow, 'tape, 'value>

Source§

impl<'tape, 'input> ValueAsScalar for simd_json::tape::Value<'tape, 'input>
where 'input: 'tape,

Source§

impl<'value> ValueAsScalar for simd_json::borrowed::Value<'value>