Enum Item
pub enum Item {
None,
Value(Value),
Table(Table),
ArrayOfTables(ArrayOfTables),
}
dep_toml_edit
only.Expand description
Type representing either a value, a table, an array of tables, or none.
Variants§
None
Type representing none.
Value(Value)
Type representing value.
Table(Table)
Type representing table.
ArrayOfTables(ArrayOfTables)
Type representing array of tables.
Implementations§
§impl Item
Downcasting
impl Item
Downcasting
pub fn get<I>(&self, index: I) -> Option<&Item> ⓘwhere
I: Index,
pub fn get<I>(&self, index: I) -> Option<&Item> ⓘwhere
I: Index,
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 None
if:
- The type of
self
does not match the type of the index, for example if the index is a string andself
is an array or a number. - The given key does not exist in the map or the given index is not within the bounds of the array.
pub fn get_mut<I>(&mut self, index: I) -> Option<&mut Item> ⓘwhere
I: Index,
pub fn get_mut<I>(&mut self, index: I) -> Option<&mut Item> ⓘwhere
I: Index,
Mutably 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 None
if:
- The type of
self
does not match the type of the index, for example if the index is a string andself
is an array or a number. - The given key does not exist in the map or the given index is not within the bounds of the array.
pub fn as_array_of_tables(&self) -> Option<&ArrayOfTables> ⓘ
pub fn as_array_of_tables(&self) -> Option<&ArrayOfTables> ⓘ
Casts self
to array of tables.
pub fn as_value_mut(&mut self) -> Option<&mut Value> ⓘ
pub fn as_value_mut(&mut self) -> Option<&mut Value> ⓘ
Casts self
to mutable value.
pub fn as_table_mut(&mut self) -> Option<&mut Table> ⓘ
pub fn as_table_mut(&mut self) -> Option<&mut Table> ⓘ
Casts self
to mutable table.
pub fn as_array_of_tables_mut(&mut self) -> Option<&mut ArrayOfTables> ⓘ
pub fn as_array_of_tables_mut(&mut self) -> Option<&mut ArrayOfTables> ⓘ
Casts self
to mutable array of tables.
pub fn into_value(self) -> Result<Value, Item> ⓘ
pub fn into_value(self) -> Result<Value, Item> ⓘ
Casts self
to value.
pub fn make_value(&mut self)
pub fn make_value(&mut self)
In-place convert to a value
pub fn into_table(self) -> Result<Table, Item> ⓘ
pub fn into_table(self) -> Result<Table, Item> ⓘ
Casts self
to table.
pub fn into_array_of_tables(self) -> Result<ArrayOfTables, Item> ⓘ
pub fn into_array_of_tables(self) -> Result<ArrayOfTables, Item> ⓘ
Casts self
to array of tables.
pub fn is_array_of_tables(&self) -> bool
pub fn is_array_of_tables(&self) -> bool
Returns true if self
is an array of tables.
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.
pub fn as_table_like(&self) -> Option<&dyn TableLike> ⓘ
pub fn as_table_like(&self) -> Option<&dyn TableLike> ⓘ
Casts self
to either a table or an inline table.
pub fn as_table_like_mut(&mut self) -> Option<&mut dyn TableLike> ⓘ
pub fn as_table_like_mut(&mut self) -> Option<&mut dyn TableLike> ⓘ
Casts self
to either a table or an inline table.
pub fn is_table_like(&self) -> bool
pub fn is_table_like(&self) -> bool
Returns true if self
is either a table, or an inline table.
Trait Implementations§
§impl From<ArrayOfTables> for Item
impl From<ArrayOfTables> for Item
§fn from(s: ArrayOfTables) -> Item
fn from(s: ArrayOfTables) -> Item
Auto Trait Implementations§
impl Freeze for Item
impl RefUnwindSafe for Item
impl Send for Item
impl Sync for Item
impl Unpin for Item
impl UnwindSafe for Item
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> ByteSized for T
impl<T> ByteSized for T
Source§const BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
Source§fn byte_align(&self) -> usize
fn byte_align(&self) -> usize
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
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 = _
Source§fn mem_align_of<T>() -> usize
fn mem_align_of<T>() -> usize
Source§fn mem_align_of_val(&self) -> usize
fn mem_align_of_val(&self) -> usize
Source§fn mem_size_of<T>() -> usize
fn mem_size_of<T>() -> usize
Source§fn mem_size_of_val(&self) -> usize
fn mem_size_of_val(&self) -> usize
Source§fn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
true
if dropping values of this type matters. Read moreSource§fn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
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
unsafe_layout
only.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
unsafe_layout
only.T
represented by the all-zero byte-pattern. Read moreSource§fn mem_as_bytes(&self) -> &[u8] ⓘ
fn mem_as_bytes(&self) -> &[u8] ⓘ
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> ⓘ
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> ⓘ
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