Enum jsonb::Value

source ·
pub enum Value<'a> {
    Null,
    Bool(bool),
    String(Cow<'a, str>),
    Number(Number),
    Array(Vec<Value<'a>>),
    Object(Object<'a>),
}

Variants§

§

Null

§

Bool(bool)

§

String(Cow<'a, str>)

§

Number(Number)

§

Array(Vec<Value<'a>>)

§

Object(Object<'a>)

Implementations§

source§

impl<'a> Value<'a>

source

pub fn is_object(&self) -> bool

source

pub fn as_object(&self) -> Option<&Object<'a>>

source

pub fn is_array(&self) -> bool

source

pub fn as_array(&self) -> Option<&Vec<Value<'a>>>

source

pub fn is_string(&self) -> bool

source

pub fn as_str(&self) -> Option<&Cow<'_, str>>

source

pub fn is_number(&self) -> bool

source

pub fn as_number(&self) -> Option<&Number>

source

pub fn is_i64(&self) -> bool

source

pub fn is_u64(&self) -> bool

source

pub fn is_f64(&self) -> bool

source

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

source

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

source

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

source

pub fn is_boolean(&self) -> bool

source

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

source

pub fn is_null(&self) -> bool

source

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

source

pub fn write_to_vec(&self, buf: &mut Vec<u8>)

Serialize the JSONB Value into a byte stream.

source

pub fn to_vec(&self) -> Vec<u8>

Serialize the JSONB Value into a byte stream.

source

pub fn get_by_name_ignore_case(&self, name: &str) -> Option<&Value<'a>>

source

pub fn array_length(&self) -> Option<usize>

source

pub fn object_keys(&self) -> Option<Value<'a>>

Trait Implementations§

source§

impl<'a> Clone for Value<'a>

source§

fn clone(&self) -> Value<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for Value<'a>

source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Default for Value<'a>

source§

fn default() -> Value<'a>

Returns the “default value” for a type. Read more
source§

impl<'a> Display for Value<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a, T: Clone + Into<Value<'a>>> From<&'a [T]> for Value<'a>

source§

fn from(f: &'a [T]) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&Value> for Value<'a>

source§

fn from(value: &JsonValue) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a str> for Value<'a>

source§

fn from(f: &'a str) -> Self

Converts to this type from the input type.
source§

impl<'a> From<()> for Value<'a>

source§

fn from((): ()) -> Self

Converts to this type from the input type.
source§

impl<'a> From<BTreeMap<String, Value<'a>>> for Value<'a>

source§

fn from(o: Object<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Cow<'a, str>> for Value<'a>

source§

fn from(f: Cow<'a, str>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<OrderedFloat<f32>> for Value<'a>

source§

fn from(f: OrderedFloat<f32>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<OrderedFloat<f64>> for Value<'a>

source§

fn from(f: OrderedFloat<f64>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<String> for Value<'a>

source§

fn from(f: String) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Value<'a>> for Value

source§

fn from(value: Value<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Value> for Value<'a>

source§

fn from(value: JsonValue) -> Self

Converts to this type from the input type.
source§

impl<'a, T: Into<Value<'a>>> From<Vec<T>> for Value<'a>

source§

fn from(f: Vec<T>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<bool> for Value<'a>

source§

fn from(f: bool) -> Self

Converts to this type from the input type.
source§

impl<'a> From<f32> for Value<'a>

source§

fn from(n: f32) -> Self

Converts to this type from the input type.
source§

impl<'a> From<f64> for Value<'a>

source§

fn from(n: f64) -> Self

Converts to this type from the input type.
source§

impl<'a> From<i16> for Value<'a>

source§

fn from(n: i16) -> Self

Converts to this type from the input type.
source§

impl<'a> From<i32> for Value<'a>

source§

fn from(n: i32) -> Self

Converts to this type from the input type.
source§

impl<'a> From<i64> for Value<'a>

source§

fn from(n: i64) -> Self

Converts to this type from the input type.
source§

impl<'a> From<i8> for Value<'a>

source§

fn from(n: i8) -> Self

Converts to this type from the input type.
source§

impl<'a> From<isize> for Value<'a>

source§

fn from(n: isize) -> Self

Converts to this type from the input type.
source§

impl<'a> From<u16> for Value<'a>

source§

fn from(n: u16) -> Self

Converts to this type from the input type.
source§

impl<'a> From<u32> for Value<'a>

source§

fn from(n: u32) -> Self

Converts to this type from the input type.
source§

impl<'a> From<u64> for Value<'a>

source§

fn from(n: u64) -> Self

Converts to this type from the input type.
source§

impl<'a> From<u8> for Value<'a>

source§

fn from(n: u8) -> Self

Converts to this type from the input type.
source§

impl<'a> From<usize> for Value<'a>

source§

fn from(n: usize) -> Self

Converts to this type from the input type.
source§

impl<'a, K: Into<String>, V: Into<Value<'a>>> FromIterator<(K, V)> for Value<'a>

source§

fn from_iter<I: IntoIterator<Item = (K, V)>>(iter: I) -> Self

Creates a value from an iterator. Read more
source§

impl<'a, T: Into<Value<'a>>> FromIterator<T> for Value<'a>

source§

fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self

Creates a value from an iterator. Read more
source§

impl<'a> PartialEq for Value<'a>

source§

fn eq(&self, other: &Value<'a>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> Eq for Value<'a>

source§

impl<'a> StructuralEq for Value<'a>

source§

impl<'a> StructuralPartialEq for Value<'a>

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Value<'a>

§

impl<'a> Send for Value<'a>

§

impl<'a> Sync for Value<'a>

§

impl<'a> Unpin for Value<'a>

§

impl<'a> UnwindSafe for Value<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V