simd_json::prelude

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>