[][src]Trait simd_json::value::Value

pub trait Value: Sized + Index<usize> + PartialEq<i8> + PartialEq<i16> + PartialEq<i32> + PartialEq<i64> + PartialEq<i128> + PartialEq<u8> + PartialEq<u16> + PartialEq<u32> + PartialEq<u64> + PartialEq<u128> + PartialEq<f32> + PartialEq<f64> + PartialEq<String> + PartialEq<bool> + PartialEq<()> {
    type Key;
    fn value_type(&self) -> ValueType;
fn is_null(&self) -> bool;
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 cast_f64(&self) -> Option<f64>;
fn as_str(&self) -> Option<&str>;
fn as_array(&self) -> Option<&Vec<Self>>;
fn as_object(&self) -> Option<&HashMap<Self::Key, Self>>; fn get<Q: ?Sized>(&self, k: &Q) -> Option<&Self>
    where
        Self::Key: Borrow<Q> + Hash + Eq,
        Q: Hash + Eq
, { ... }
fn get_idx(&self, i: usize) -> Option<&Self> { ... }
fn is_bool(&self) -> bool { ... }
fn as_i128(&self) -> Option<i128> { ... }
fn is_i128(&self) -> bool { ... }
fn is_i64(&self) -> bool { ... }
fn as_i32(&self) -> Option<i32> { ... }
fn is_i32(&self) -> bool { ... }
fn as_i16(&self) -> Option<i16> { ... }
fn is_i16(&self) -> bool { ... }
fn as_i8(&self) -> Option<i8> { ... }
fn is_i8(&self) -> bool { ... }
fn as_u128(&self) -> Option<u128> { ... }
fn is_u128(&self) -> bool { ... }
fn is_u64(&self) -> bool { ... }
fn as_usize(&self) -> Option<usize> { ... }
fn is_usize(&self) -> bool { ... }
fn as_u32(&self) -> Option<u32> { ... }
fn is_u32(&self) -> bool { ... }
fn as_u16(&self) -> Option<u16> { ... }
fn is_u16(&self) -> bool { ... }
fn as_u8(&self) -> Option<u8> { ... }
fn is_u8(&self) -> bool { ... }
fn is_f64(&self) -> bool { ... }
fn is_f64_castable(&self) -> bool { ... }
fn as_f32(&self) -> Option<f32> { ... }
fn is_f32(&self) -> bool { ... }
fn is_str(&self) -> bool { ... }
fn is_array(&self) -> bool { ... }
fn is_object(&self) -> bool { ... } }

The Value exposes common interface for values, this allows using both BorrowedValue and OwnedValue nearly interchangable

Associated Types

type Key

The type for Objects

Loading content...

Required methods

fn value_type(&self) -> ValueType

Returns the type of the current Valye

fn is_null(&self) -> bool

returns true if the current value is null

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

Tries to represent the value as a bool

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

Tries to represent the value as an i64

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

Tries to represent the value as an u64

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

Tries to represent the value as a f64

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

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

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

Tries to represent the value as a &str

fn as_array(&self) -> Option<&Vec<Self>>

Tries to represent the value as an array and returns a refference to it

fn as_object(&self) -> Option<&HashMap<Self::Key, Self>>

Tries to represent the value as an object and returns a refference to it

Loading content...

Provided methods

fn get<Q: ?Sized>(&self, k: &Q) -> Option<&Self> where
    Self::Key: Borrow<Q> + Hash + Eq,
    Q: Hash + Eq

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.

fn get_idx(&self, i: usize) -> Option<&Self>

Gets a ref to a value based on n index, returns None if the current Value isn't an Array or doesn't contain the index it was asked for.

fn is_bool(&self) -> bool

returns true if the current value a bool

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

Tries to represent the value as an i128

fn is_i128(&self) -> bool

returns true if the current value can be represented as a i128

fn is_i64(&self) -> bool

returns true if the current value can be represented as a i64

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

Tries to represent the value as an i32

fn is_i32(&self) -> bool

returns true if the current value can be represented as a i32

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

Tries to represent the value as an i16

fn is_i16(&self) -> bool

returns true if the current value can be represented as a i16

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

Tries to represent the value as an i8

fn is_i8(&self) -> bool

returns true if the current value can be represented as a i8

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

Tries to represent the value as an u128

fn is_u128(&self) -> bool

returns true if the current value can be represented as a u128

fn is_u64(&self) -> bool

returns true if the current value can be represented as a u64

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

Tries to represent the value as an usize

fn is_usize(&self) -> bool

returns true if the current value can be represented as a usize

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

Tries to represent the value as an u32

fn is_u32(&self) -> bool

returns true if the current value can be represented as a u32

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

Tries to represent the value as an u16

fn is_u16(&self) -> bool

returns true if the current value can be represented as a u16

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

Tries to represent the value as an u8

fn is_u8(&self) -> bool

returns true if the current value can be represented as a u8

fn is_f64(&self) -> bool

returns true if the current value can be represented as a f64

fn is_f64_castable(&self) -> bool

returns true if the current value can be cast into a f64

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

Tries to represent the value as a f32

fn is_f32(&self) -> bool

returns true if the current value can be represented as a f64

fn is_str(&self) -> bool

returns true if the current value can be represented as a str

fn is_array(&self) -> bool

returns true if the current value can be represented as an array

fn is_object(&self) -> bool

returns true if the current value can be represented as an object

Loading content...

Implementors

impl Value for simd_json::value::owned::Value[src]

type Key = String

impl<'v> Value for simd_json::value::borrowed::Value<'v>[src]

type Key = Cow<'v, str>

Loading content...