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 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
Source§impl From<InlineTable> for Value
impl From<InlineTable> for Value
Source§fn from(table: InlineTable) -> Self
fn from(table: InlineTable) -> Self
Source§impl From<InternalString> for Value
impl From<InternalString> for Value
Source§fn from(s: InternalString) -> Self
fn from(s: InternalString) -> Self
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 176 bytes
Size for each variant:
String
: 104 bytesInteger
: 88 bytesFloat
: 88 bytesBoolean
: 88 bytesDatetime
: 104 bytesArray
: 136 bytesInlineTable
: 176 bytes