Skip to main content

ValueView

Enum ValueView 

Source
#[non_exhaustive]
pub enum ValueView<'a> {
Show 15 variants None, BorrowedStr(&'a str), StaticStr(&'static str), Bytes(&'a [u8]), Bool(bool), I64(i64), U64(u64), F64(f64), I128(i128), U128(u128), Char(char), List(ListValue<'a>), Map(MapValue<'a>), Debug(DebugValue<'a>), Display(DisplayValue<'a>),
}
Expand description

A borrowed view of a value.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

None

The absence of a value.

§

BorrowedStr(&'a str)

A borrowed string value.

§

StaticStr(&'static str)

A static string value.

§

Bytes(&'a [u8])

A byte array value.

§

Bool(bool)

A boolean value.

§

I64(i64)

A signed 64-bit integer value.

§

U64(u64)

An unsigned 64-bit integer value.

§

F64(f64)

A 64-bit floating point value.

§

I128(i128)

A signed 128-bit integer value.

§

U128(u128)

An unsigned 128-bit integer value.

§

Char(char)

A Unicode scalar value.

§

List(ListValue<'a>)

A list value.

§

Map(MapValue<'a>)

A map value.

§

Debug(DebugValue<'a>)

A lazily debug-formatted value.

§

Display(DisplayValue<'a>)

A lazily display-formatted value.

Implementations§

Source§

impl ValueView<'_>

Source

pub fn to_owned(&self) -> ValueOwned

Convert this view into an owned value.

Source§

impl<'a> ValueView<'a>

Source

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

Try to convert this view into a boolean.

Source

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

Try to convert this view into a signed 64-bit integer.

Source

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

Try to convert this view into an unsigned 64-bit integer.

Source

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

Try to convert this view into a 64-bit floating point number.

Source

pub fn to_i128(&self) -> Option<i128>

Try to convert this view into a signed 128-bit integer.

Source

pub fn to_u128(&self) -> Option<u128>

Try to convert this view into an unsigned 128-bit integer.

Source

pub fn to_char(&self) -> Option<char>

Try to convert this view into a Unicode scalar value.

Source

pub fn to_str(&self) -> Option<&'a str>

Try to convert this view into a string slice.

Source

pub fn to_static_str(&self) -> Option<&'static str>

Try to convert this view into a static string slice.

Source

pub fn to_display(&self) -> Option<DisplayValue<'a>>

Try to convert this view into a display-formatted value.

Source

pub fn to_list(&self) -> Option<ListValue<'a>>

Try to convert this view into a list value.

Source

pub fn to_map(&self) -> Option<MapValue<'a>>

Try to convert this view into a map value.

Source

pub fn to_debug(&self) -> Option<DebugValue<'a>>

Try to convert this view into a debug-formatted value.

Trait Implementations§

Source§

impl<'a> Clone for ValueView<'a>

Source§

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

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for ValueView<'a>

Source§

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

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

impl Display for ValueView<'_>

Source§

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

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

impl Serialize for ValueView<'_>

Available on crate feature serde only.
Source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for ValueView<'a>

§

impl<'a> !RefUnwindSafe for ValueView<'a>

§

impl<'a> !Send for ValueView<'a>

§

impl<'a> !Sync for ValueView<'a>

§

impl<'a> Unpin for ValueView<'a>

§

impl<'a> UnsafeUnpin for ValueView<'a>

§

impl<'a> !UnwindSafe for ValueView<'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
Source§

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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,

Source§

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§

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>,

Source§

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>,

Source§

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.