Enum DeValue
pub 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(Datetime) Represents a TOML datetime
-
Array(DeArray<'i>) Represents a TOML array
-
Table(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(&mut self)Ensure no data is borrowed
fn get<I: Index>(&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
Noneif the type ofselfdoes not match the type of the index, for example if the index is a string andselfis an array or a number. Also returnsNoneif 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) -> Option<&DeInteger<'i>>Extracts the integer value if it is an integer.
fn is_integer(&self) -> boolTests whether this value is an integer.
fn as_float(&self) -> Option<&DeFloat<'i>>Extracts the float value if it is a float.
fn is_float(&self) -> boolTests whether this value is a float.
fn as_bool(&self) -> Option<bool>Extracts the boolean value if it is a boolean.
fn is_bool(&self) -> boolTests whether this value is a boolean.
fn as_str(&self) -> Option<&str>Extracts the string of this value if it is a string.
fn is_str(&self) -> boolTests if this value is a string.
fn as_datetime(&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:00Zfn is_datetime(&self) -> boolTests whether this value is a datetime.
fn as_array(&self) -> Option<&DeArray<'i>>Extracts the array value if it is an array.
fn is_array(&self) -> boolTests whether this value is an array.
fn as_table(&self) -> Option<&DeTable<'i>>Extracts the table value if it is a table.
fn is_table(&self) -> boolTests whether this value is a table.
fn same_type(&self, other: &DeValue<'_>) -> boolTests whether this and another value have the same type.
fn type_str(&self) -> &'static strReturns a human-readable representation of the type of this value.
Trait Implementations
impl<'i> Clone for DeValue<'i>
fn clone(&self) -> DeValue<'i>
impl<'i> Debug for DeValue<'i>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<I> Index<I> for DeValue<'_>
where
I: Index,
type Output = Spanned<DeValue<'_>>;fn index(&self, index: I) -> &Spanned<Self>
Auto Trait Implementations
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>
Blanket Implementations
impl<T> Any for DeValue<'i>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for DeValue<'i>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for DeValue<'i>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for DeValue<'i>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for DeValue<'i>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for DeValue<'i>
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for DeValue<'i>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for DeValue<'i>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for DeValue<'i>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>