Enum DeValue

enum DeValue<'i>

Representation of a TOML value.

Variants

String(DeString<'i>)

Represents a TOML string

Integer(DeInteger<'i>)

Represents a TOML integer

Float(DeFloat<'i>)

Represents a TOML float

Boolean(bool)

Represents a TOML boolean

Datetime(toml_datetime::Datetime)

Represents a TOML datetime

Array(crate::de::DeArray<'i>)

Represents a TOML array

Table(crate::de::DeTable<'i>)

Represents a TOML table

Implementations

impl<'i> DeValue<'i>

fn parse(input: &'i str) -> Result<Spanned<Self>, Error>

Parse a TOML value

fn parse_recoverable(input: &'i str) -> (Spanned<Self>, Vec<Error>)

Parse a TOML value, with best effort recovery on error

fn make_owned(self: &mut Self)

Ensure no data is borrowed

fn get<I: Index>(self: &Self, index: I) -> Option<&Spanned<Self>>

Index into a TOML array or map. A string index can be used to access a value in a map, and a usize index can be used to access an element of an array.

Returns None if the type of self does not match the type of the index, for example if the index is a string and self is an array or a number. Also returns None if the given key does not exist in the map or the given index is not within the bounds of the array.

fn as_integer(self: &Self) -> Option<&DeInteger<'i>>

Extracts the integer value if it is an integer.

fn is_integer(self: &Self) -> bool

Tests whether this value is an integer.

fn as_float(self: &Self) -> Option<&DeFloat<'i>>

Extracts the float value if it is a float.

fn is_float(self: &Self) -> bool

Tests whether this value is a float.

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

Extracts the boolean value if it is a boolean.

fn is_bool(self: &Self) -> bool

Tests whether this value is a boolean.

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

Extracts the string of this value if it is a string.

fn is_str(self: &Self) -> bool

Tests if this value is a string.

fn as_datetime(self: &Self) -> Option<&Datetime>

Extracts the datetime value if it is a datetime.

Note that a parsed TOML value will only contain ISO 8601 dates. An example date is:

1979-05-27T07:32:00Z
fn is_datetime(self: &Self) -> bool

Tests whether this value is a datetime.

fn as_array(self: &Self) -> Option<&DeArray<'i>>

Extracts the array value if it is an array.

fn is_array(self: &Self) -> bool

Tests whether this value is an array.

fn as_table(self: &Self) -> Option<&DeTable<'i>>

Extracts the table value if it is a table.

fn is_table(self: &Self) -> bool

Tests whether this value is a table.

fn same_type(self: &Self, other: &DeValue<'_>) -> bool

Tests whether this and another value have the same type.

fn type_str(self: &Self) -> &'static str

Returns a human-readable representation of the type of this value.

impl<'i> Clone for DeValue<'i>

fn clone(self: &Self) -> DeValue<'i>

impl<'i> Debug for DeValue<'i>

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

impl<'i> Freeze for DeValue<'i>

impl<'i> RefUnwindSafe for DeValue<'i>

impl<'i> Send for DeValue<'i>

impl<'i> Sync for DeValue<'i>

impl<'i> Unpin for DeValue<'i>

impl<'i> UnsafeUnpin for DeValue<'i>

impl<'i> UnwindSafe for DeValue<'i>

impl<I> Index for DeValue<'_>

fn index(self: &Self, index: I) -> &Spanned<Self>

impl<T> Any for DeValue<'i>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for DeValue<'i>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for DeValue<'i>

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

impl<T> CloneToUninit for DeValue<'i>

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

impl<T> From for DeValue<'i>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for DeValue<'i>

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for DeValue<'i>

fn into(self: Self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom for DeValue<'i>

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

impl<T, U> TryInto for DeValue<'i>

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