pub struct InlineTable { /* private fields */ }
Expand description
Type representing a TOML inline table,
payload of the Value::InlineTable
variant
Implementations§
Source§impl InlineTable
Constructors
impl InlineTable
Constructors
See also FromIterator
Sourcepub fn into_table(self) -> Table
pub fn into_table(self) -> Table
Convert to a table
Source§impl InlineTable
Formatting
impl InlineTable
Formatting
Sourcepub fn get_values(&self) -> Vec<(Vec<&Key>, &Value)>
pub fn get_values(&self) -> Vec<(Vec<&Key>, &Value)>
Get key/values for values that are visually children of this table
For example, this will return dotted keys
Sourcepub fn sort_values(&mut self)
pub fn sort_values(&mut self)
Sorts the key/value pairs by key.
Sourcepub fn sort_values_by<F>(&mut self, compare: F)
pub fn sort_values_by<F>(&mut self, compare: F)
Sort Key/Value Pairs of the table using the using the comparison function compare
.
The comparison function receives two key and value pairs to compare (you can sort by keys or values or their combination as needed).
Sourcepub fn set_dotted(&mut self, yes: bool)
pub fn set_dotted(&mut self, yes: bool)
Change this table’s dotted status
Sourcepub fn is_dotted(&self) -> bool
pub fn is_dotted(&self) -> bool
Check if this is a wrapper for dotted keys, rather than a standard table
Sourcepub fn key_mut(&mut self, key: &str) -> Option<KeyMut<'_>>
pub fn key_mut(&mut self, key: &str) -> Option<KeyMut<'_>>
Returns an accessor to a key’s formatting
Sourcepub fn key_decor_mut(&mut self, key: &str) -> Option<&mut Decor>
👎Deprecated since 0.21.1: Replaced with key_mut
pub fn key_decor_mut(&mut self, key: &str) -> Option<&mut Decor>
key_mut
Returns the decor associated with a given key of the table.
Sourcepub fn key_decor(&self, key: &str) -> Option<&Decor>
👎Deprecated since 0.21.1: Replaced with key_mut
pub fn key_decor(&self, key: &str) -> Option<&Decor>
key_mut
Returns the decor associated with a given key of the table.
Sourcepub fn set_preamble(&mut self, preamble: impl Into<RawString>)
pub fn set_preamble(&mut self, preamble: impl Into<RawString>)
Set whitespace after before element
Source§impl InlineTable
impl InlineTable
Sourcepub fn iter(&self) -> InlineTableIter<'_>
pub fn iter(&self) -> InlineTableIter<'_>
Returns an iterator over key/value pairs.
Sourcepub fn iter_mut(&mut self) -> InlineTableIterMut<'_>
pub fn iter_mut(&mut self) -> InlineTableIterMut<'_>
Returns an iterator over key/value pairs.
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clears the table, removing all key-value pairs. Keeps the allocated memory for reuse.
Sourcepub fn entry(&mut self, key: impl Into<InternalString>) -> InlineEntry<'_>
pub fn entry(&mut self, key: impl Into<InternalString>) -> InlineEntry<'_>
Gets the given key’s corresponding entry in the Table for in-place manipulation.
Sourcepub fn entry_format<'a>(&'a mut self, key: &Key) -> InlineEntry<'a>
pub fn entry_format<'a>(&'a mut self, key: &Key) -> InlineEntry<'a>
Gets the given key’s corresponding entry in the Table for in-place manipulation.
Sourcepub fn get(&self, key: &str) -> Option<&Value>
pub fn get(&self, key: &str) -> Option<&Value>
Return an optional reference to the value at the given the key.
Sourcepub fn get_mut(&mut self, key: &str) -> Option<&mut Value>
pub fn get_mut(&mut self, key: &str) -> Option<&mut Value>
Return an optional mutable reference to the value at the given the key.
Sourcepub fn get_key_value<'a>(&'a self, key: &str) -> Option<(&'a Key, &'a Item)>
pub fn get_key_value<'a>(&'a self, key: &str) -> Option<(&'a Key, &'a Item)>
Return references to the key-value pair stored for key, if it is present, else None.
Sourcepub fn get_key_value_mut<'a>(
&'a mut self,
key: &str,
) -> Option<(KeyMut<'a>, &'a mut Item)>
pub fn get_key_value_mut<'a>( &'a mut self, key: &str, ) -> Option<(KeyMut<'a>, &'a mut Item)>
Return mutable references to the key-value pair stored for key, if it is present, else None.
Sourcepub fn contains_key(&self, key: &str) -> bool
pub fn contains_key(&self, key: &str) -> bool
Returns true if the table contains given key.
Sourcepub fn get_or_insert<V: Into<Value>>(
&mut self,
key: impl Into<InternalString>,
value: V,
) -> &mut Value
pub fn get_or_insert<V: Into<Value>>( &mut self, key: impl Into<InternalString>, value: V, ) -> &mut Value
Inserts a key/value pair if the table does not contain the key. Returns a mutable reference to the corresponding value.
Sourcepub fn insert(
&mut self,
key: impl Into<InternalString>,
value: Value,
) -> Option<Value>
pub fn insert( &mut self, key: impl Into<InternalString>, value: Value, ) -> Option<Value>
Inserts a key-value pair into the map.
Sourcepub fn insert_formatted(&mut self, key: &Key, value: Value) -> Option<Value>
pub fn insert_formatted(&mut self, key: &Key, value: Value) -> Option<Value>
Inserts a key-value pair into the map.
Trait Implementations§
Source§impl Clone for InlineTable
impl Clone for InlineTable
Source§fn clone(&self) -> InlineTable
fn clone(&self) -> InlineTable
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for InlineTable
impl Debug for InlineTable
Source§impl Default for InlineTable
impl Default for InlineTable
Source§fn default() -> InlineTable
fn default() -> InlineTable
Source§impl Display for InlineTable
impl Display for InlineTable
Source§impl<K: Into<Key>, V: Into<Value>> Extend<(K, V)> for InlineTable
impl<K: Into<Key>, V: Into<Value>> Extend<(K, V)> for InlineTable
Source§fn extend<T: IntoIterator<Item = (K, V)>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = (K, V)>>(&mut self, iter: T)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Source§impl From<InlineTable> for Value
impl From<InlineTable> for Value
Source§fn from(table: InlineTable) -> Self
fn from(table: InlineTable) -> Self
Source§impl<K: Into<Key>, V: Into<Value>> FromIterator<(K, V)> for InlineTable
impl<K: Into<Key>, V: Into<Value>> FromIterator<(K, V)> for InlineTable
Source§impl<'s> Index<&'s str> for InlineTable
impl<'s> Index<&'s str> for InlineTable
Source§impl<'s> IndexMut<&'s str> for InlineTable
impl<'s> IndexMut<&'s str> for InlineTable
Source§impl<'s> IntoIterator for &'s InlineTable
impl<'s> IntoIterator for &'s InlineTable
Source§impl IntoIterator for InlineTable
impl IntoIterator for InlineTable
Source§impl TableLike for InlineTable
impl TableLike for InlineTable
Source§fn iter_mut(&mut self) -> IterMut<'_>
fn iter_mut(&mut self) -> IterMut<'_>
Source§fn clear(&mut self)
fn clear(&mut self)
Source§fn entry<'a>(&'a mut self, key: &str) -> Entry<'a>
fn entry<'a>(&'a mut self, key: &str) -> Entry<'a>
Source§fn entry_format<'a>(&'a mut self, key: &Key) -> Entry<'a>
fn entry_format<'a>(&'a mut self, key: &Key) -> Entry<'a>
Source§fn get<'s>(&'s self, key: &str) -> Option<&'s Item>
fn get<'s>(&'s self, key: &str) -> Option<&'s Item>
Source§fn get_mut<'s>(&'s mut self, key: &str) -> Option<&'s mut Item>
fn get_mut<'s>(&'s mut self, key: &str) -> Option<&'s mut Item>
Source§fn get_key_value<'a>(&'a self, key: &str) -> Option<(&'a Key, &'a Item)>
fn get_key_value<'a>(&'a self, key: &str) -> Option<(&'a Key, &'a Item)>
Source§fn get_key_value_mut<'a>(
&'a mut self,
key: &str,
) -> Option<(KeyMut<'a>, &'a mut Item)>
fn get_key_value_mut<'a>( &'a mut self, key: &str, ) -> Option<(KeyMut<'a>, &'a mut Item)>
Source§fn contains_key(&self, key: &str) -> bool
fn contains_key(&self, key: &str) -> bool
Source§fn insert(&mut self, key: &str, value: Item) -> Option<Item>
fn insert(&mut self, key: &str, value: Item) -> Option<Item>
Source§fn get_values(&self) -> Vec<(Vec<&Key>, &Value)>
fn get_values(&self) -> Vec<(Vec<&Key>, &Value)>
Source§fn sort_values(&mut self)
fn sort_values(&mut self)
Source§fn set_dotted(&mut self, yes: bool)
fn set_dotted(&mut self, yes: bool)
Source§fn is_dotted(&self) -> bool
fn is_dotted(&self) -> bool
Source§fn key_mut(&mut self, key: &str) -> Option<KeyMut<'_>>
fn key_mut(&mut self, key: &str) -> Option<KeyMut<'_>>
Source§fn key_decor_mut(&mut self, key: &str) -> Option<&mut Decor>
fn key_decor_mut(&mut self, key: &str) -> Option<&mut Decor>
key_mut