pub enum Value {
String(Formatted<String>),
Integer(Formatted<i64>),
Float(Formatted<f64>),
Boolean(Formatted<bool>),
Datetime(Formatted<Datetime>),
Array(Array),
InlineTable(InlineTable),
}
Expand description
Representation of a TOML Value (as part of a Key/Value Pair).
Variants§
String(Formatted<String>)
A string value.
Integer(Formatted<i64>)
A 64-bit integer value.
Float(Formatted<f64>)
A 64-bit float value.
Boolean(Formatted<bool>)
A boolean value.
Datetime(Formatted<Datetime>)
An RFC 3339 formatted date-time with offset.
Array(Array)
An inline array of values.
InlineTable(InlineTable)
An inline table of key/value pairs.
Implementations§
Source§impl Value
Downcasting
impl Value
Downcasting
Sourcepub fn as_integer(&self) -> Option<i64>
pub fn as_integer(&self) -> Option<i64>
Casts self
to integer.
Sourcepub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Returns true if self
is an integer.
Sourcepub fn as_datetime(&self) -> Option<&Datetime>
pub fn as_datetime(&self) -> Option<&Datetime>
Casts self
to date-time.
Sourcepub fn is_datetime(&self) -> bool
pub fn is_datetime(&self) -> bool
Returns true if self
is a date-time.
Sourcepub fn as_array_mut(&mut self) -> Option<&mut Array>
pub fn as_array_mut(&mut self) -> Option<&mut Array>
Casts self
to mutable array.
Sourcepub fn as_inline_table(&self) -> Option<&InlineTable>
pub fn as_inline_table(&self) -> Option<&InlineTable>
Casts self
to inline table.
Sourcepub fn as_inline_table_mut(&mut self) -> Option<&mut InlineTable>
pub fn as_inline_table_mut(&mut self) -> Option<&mut InlineTable>
Casts self
to mutable inline table.
Sourcepub fn is_inline_table(&self) -> bool
pub fn is_inline_table(&self) -> bool
Returns true if self
is an inline table.
Source§impl Value
impl Value
Sourcepub fn decor_mut(&mut self) -> &mut Decor
pub fn decor_mut(&mut self) -> &mut Decor
Get the decoration of the value.
§Example
let v = toml_edit::Value::from(true);
assert_eq!(v.decor().suffix(), None);
Sourcepub fn decor(&self) -> &Decor
pub fn decor(&self) -> &Decor
Get the decoration of the value.
§Example
let v = toml_edit::Value::from(true);
assert_eq!(v.decor().suffix(), None);
Trait Implementations§
Source§impl<'b> From<&'b InternalString> for Value
impl<'b> From<&'b InternalString> for Value
Source§fn from(s: &'b InternalString) -> Self
fn from(s: &'b InternalString) -> Self
Converts to this type from the input type.
Source§impl From<InlineTable> for Value
impl From<InlineTable> for Value
Source§fn from(table: InlineTable) -> Self
fn from(table: InlineTable) -> Self
Converts to this type from the input type.
Source§impl From<InternalString> for Value
impl From<InternalString> for Value
Source§fn from(s: InternalString) -> Self
fn from(s: InternalString) -> Self
Converts to this type from the input type.
Source§impl<V: Into<Value>> FromIterator<V> for Value
impl<V: Into<Value>> FromIterator<V> for Value
Source§fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = V>,
fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = V>,
Creates a value from an iterator. Read more
Source§impl<'de> IntoDeserializer<'de, Error> for Value
impl<'de> IntoDeserializer<'de, Error> for Value
Source§type Deserializer = ValueDeserializer
type Deserializer = ValueDeserializer
The type of the deserializer being converted into.
Source§fn into_deserializer(self) -> Self::Deserializer
fn into_deserializer(self) -> Self::Deserializer
Convert this value into a deserializer.
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more