Enum Value
pub enum Value {
String(Formatted<String>),
Integer(Formatted<i64>),
Float(Formatted<f64>),
Boolean(Formatted<bool>),
Datetime(Formatted<Datetime>),
Array(Array),
InlineTable(InlineTable),
}
Available on crate feature
dep_toml_edit
only.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§
§impl Value
Downcasting
impl Value
Downcasting
pub fn as_integer(&self) -> Option<i64> ⓘ
pub fn as_integer(&self) -> Option<i64> ⓘ
Casts self
to integer.
pub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Returns true if self
is an integer.
pub fn as_datetime(&self) -> Option<&Datetime> ⓘ
pub fn as_datetime(&self) -> Option<&Datetime> ⓘ
Casts self
to date-time.
pub fn is_datetime(&self) -> bool
pub fn is_datetime(&self) -> bool
Returns true if self
is a date-time.
pub fn as_array_mut(&mut self) -> Option<&mut Array> ⓘ
pub fn as_array_mut(&mut self) -> Option<&mut Array> ⓘ
Casts self
to mutable array.
pub fn as_inline_table(&self) -> Option<&InlineTable> ⓘ
pub fn as_inline_table(&self) -> Option<&InlineTable> ⓘ
Casts self
to inline table.
pub 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.
pub fn is_inline_table(&self) -> bool
pub fn is_inline_table(&self) -> bool
Returns true if self
is an inline table.
§impl Value
impl Value
pub 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);
pub 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§
§impl<'b> From<&'b InternalString> for Value
impl<'b> From<&'b InternalString> for Value
§fn from(s: &'b InternalString) -> Value
fn from(s: &'b InternalString) -> Value
Converts to this type from the input type.
§impl From<InlineTable> for Value
impl From<InlineTable> for Value
§fn from(table: InlineTable) -> Value
fn from(table: InlineTable) -> Value
Converts to this type from the input type.
§impl From<InternalString> for Value
impl From<InternalString> for Value
§fn from(s: InternalString) -> Value
fn from(s: InternalString) -> Value
Converts to this type from the input type.
§impl<K, V> FromIterator<(K, V)> for Value
impl<K, V> FromIterator<(K, V)> for Value
§impl<V> FromIterator<V> for Value
impl<V> FromIterator<V> for Value
§fn from_iter<I>(iter: I) -> Valuewhere
I: IntoIterator<Item = V>,
fn from_iter<I>(iter: I) -> Valuewhere
I: IntoIterator<Item = V>,
Creates a value from an iterator. Read more
§impl IntoDeserializer<'_, Error> for Value
impl IntoDeserializer<'_, Error> for Value
§type Deserializer = ValueDeserializer
type Deserializer = ValueDeserializer
The type of the deserializer being converted into.
§fn into_deserializer(
self,
) -> <Value as IntoDeserializer<'_, Error>>::Deserializer
fn into_deserializer( self, ) -> <Value as IntoDeserializer<'_, Error>>::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
Source§impl<T> ByteSized for T
impl<T> ByteSized for T
Source§const BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
The alignment of this type in bytes.
Source§fn byte_align(&self) -> usize
fn byte_align(&self) -> usize
Returns the alignment of this type in bytes.
Source§fn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Source§impl<T, R> Chain<R> for Twhere
T: ?Sized,
impl<T, R> Chain<R> for Twhere
T: ?Sized,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ExtAny for T
impl<T> ExtAny for T
Source§fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
Returns a deterministic hash of the
TypeId
of Self
using a custom hasher.Source§fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Source§impl<T> ExtMem for Twhere
T: ?Sized,
impl<T> ExtMem for Twhere
T: ?Sized,
Source§const NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Know whether dropping values of this type matters, in compile-time.
Source§fn mem_align_of<T>() -> usize
fn mem_align_of<T>() -> usize
Returns the minimum alignment of the type in bytes. Read more
Source§fn mem_align_of_val(&self) -> usize
fn mem_align_of_val(&self) -> usize
Returns the alignment of the pointed-to value in bytes. Read more
Source§fn mem_size_of<T>() -> usize
fn mem_size_of<T>() -> usize
Returns the size of a type in bytes. Read more
Source§fn mem_size_of_val(&self) -> usize
fn mem_size_of_val(&self) -> usize
Returns the size of the pointed-to value in bytes. Read more
Source§fn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
Returns
true
if dropping values of this type matters. Read moreSource§fn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
Forgets about
self
without running its destructor. Read moreSource§fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Source§unsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
Available on crate feature
unsafe_layout
only.Returns the value of type
T
represented by the all-zero byte-pattern. Read moreSource§unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
Available on crate feature
unsafe_layout
only.Returns the value of type
T
represented by the all-zero byte-pattern. Read moreSource§fn mem_as_bytes(&self) -> &[u8] ⓘ
fn mem_as_bytes(&self) -> &[u8] ⓘ
Available on crate feature
unsafe_slice
only.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Hook for T
impl<T> Hook for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more