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
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 iff 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 iff 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 iff 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);
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
Available on crate feature serde
only.
impl<'de> IntoDeserializer<'de, Error> for Value
Available on crate feature
serde
only.§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 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