Enum toml_span::value::ValueInner

source ·
pub enum ValueInner<'de> {
    String(Cow<'de, str>),
    Integer(i64),
    Float(f64),
    Boolean(bool),
    Array(Array<'de>),
    Table(Table<'de>),
}
Expand description

The core value types that toml can deserialize to

Note that this library does not support datetime values that are part of the toml spec since I have no need of them, but could be added

Variants§

§

String(Cow<'de, str>)

A string.

This will be borrowed from the original toml source unless it contains escape characters

§

Integer(i64)

An integer

§

Float(f64)

A float

§

Boolean(bool)

A boolean

§

Array(Array<'de>)

An array

§

Table(Table<'de>)

A table

Implementations§

source§

impl<'de> ValueInner<'de>

source

pub fn type_str(&self) -> &'static str

Gets the type of the value as a string

source

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

Returns a borrowed string if this is a Self::String

source

pub fn as_table(&self) -> Option<&Table<'de>>

Returns a borrowed table if this is a Self::Table

source

pub fn as_array(&self) -> Option<&Array<'de>>

Returns a borrowed array if this is a Self::Array

source

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

Returns an i64 if this is a Self::Integer

source

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

Returns an f64 if this is a Self::Float

source

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

Returns a bool if this is a Self::Boolean

Trait Implementations§

source§

impl<'de> AsRef<ValueInner<'de>> for Value<'de>

source§

fn as_ref(&self) -> &ValueInner<'de>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<'de> Debug for ValueInner<'de>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'de> Freeze for ValueInner<'de>

§

impl<'de> RefUnwindSafe for ValueInner<'de>

§

impl<'de> Send for ValueInner<'de>

§

impl<'de> Sync for ValueInner<'de>

§

impl<'de> Unpin for ValueInner<'de>

§

impl<'de> UnwindSafe for ValueInner<'de>

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