Trait TableLike
pub trait TableLike: Sealed {
Show 23 methods
// Required methods
fn iter(&self) -> Box<dyn Iterator<Item = (&str, &Item)> + '_>;
fn iter_mut(
&mut self,
) -> Box<dyn Iterator<Item = (KeyMut<'_>, &mut Item)> + '_>;
fn clear(&mut self);
fn entry<'a>(&'a mut self, key: &str) -> Entry<'a>;
fn entry_format<'a>(&'a mut self, key: &Key) -> Entry<'a>;
fn get<'s>(&'s self, key: &str) -> Option<&'s Item> ⓘ;
fn get_mut<'s>(&'s mut self, key: &str) -> Option<&'s mut Item> ⓘ;
fn get_key_value<'a>(&'a self, key: &str) -> Option<(&'a Key, &'a Item)> ⓘ;
fn get_key_value_mut<'a>(
&'a mut self,
key: &str,
) -> Option<(KeyMut<'a>, &'a mut Item)> ⓘ;
fn contains_key(&self, key: &str) -> bool;
fn insert(&mut self, key: &str, value: Item) -> Option<Item> ⓘ;
fn remove(&mut self, key: &str) -> Option<Item> ⓘ;
fn get_values(&self) -> Vec<(Vec<&Key>, &Value)> ⓘ;
fn fmt(&mut self);
fn sort_values(&mut self);
fn set_dotted(&mut self, yes: bool);
fn is_dotted(&self) -> bool;
fn key(&self, key: &str) -> Option<&Key> ⓘ;
fn key_mut(&mut self, key: &str) -> Option<KeyMut<'_>> ⓘ;
fn key_decor_mut(&mut self, key: &str) -> Option<&mut Decor> ⓘ;
fn key_decor(&self, key: &str) -> Option<&Decor> ⓘ;
// Provided methods
fn len(&self) -> usize { ... }
fn is_empty(&self) -> bool { ... }
}
dep_toml_edit
only.Expand description
This trait represents either a Table
, or an InlineTable
.
Required Methods§
fn iter(&self) -> Box<dyn Iterator<Item = (&str, &Item)> + '_>
fn iter(&self) -> Box<dyn Iterator<Item = (&str, &Item)> + '_>
Returns an iterator over key/value pairs.
fn iter_mut(&mut self) -> Box<dyn Iterator<Item = (KeyMut<'_>, &mut Item)> + '_>
fn iter_mut(&mut self) -> Box<dyn Iterator<Item = (KeyMut<'_>, &mut Item)> + '_>
Returns an mutable iterator over all key/value pairs, including empty.
fn clear(&mut self)
fn clear(&mut self)
Clears the table, removing all key-value pairs. Keeps the allocated memory for reuse.
fn entry<'a>(&'a mut self, key: &str) -> Entry<'a>
fn entry<'a>(&'a mut self, key: &str) -> Entry<'a>
Gets the given key’s corresponding entry in the Table for in-place manipulation.
fn entry_format<'a>(&'a mut self, key: &Key) -> Entry<'a>
fn entry_format<'a>(&'a mut self, key: &Key) -> Entry<'a>
Gets the given key’s corresponding entry in the Table for in-place manipulation.
fn get<'s>(&'s self, key: &str) -> Option<&'s Item> ⓘ
fn get<'s>(&'s self, key: &str) -> Option<&'s Item> ⓘ
Returns an optional reference to an item given the key.
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> ⓘ
Returns an optional mutable reference to an item given the key.
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)> ⓘ
Return references to the key-value pair stored for key, if it is present, else None.
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)> ⓘ
Return mutable references to the key-value pair stored for key, if it is present, else None.
fn contains_key(&self, key: &str) -> bool
fn contains_key(&self, key: &str) -> bool
Returns true if the table contains an item with the given key.
fn insert(&mut self, key: &str, value: Item) -> Option<Item> ⓘ
fn insert(&mut self, key: &str, value: Item) -> Option<Item> ⓘ
Inserts a key-value pair into the map.
fn get_values(&self) -> Vec<(Vec<&Key>, &Value)> ⓘ
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
fn fmt(&mut self)
fn fmt(&mut self)
Auto formats the table.
fn sort_values(&mut self)
fn sort_values(&mut self)
Sorts Key/Value Pairs of the table.
Doesn’t affect subtables or subarrays.
fn set_dotted(&mut self, yes: bool)
fn set_dotted(&mut self, yes: bool)
Change this table’s dotted status
fn key_decor_mut(&mut self, key: &str) -> Option<&mut Decor> ⓘ
👎Deprecated since 0.21.1: Replaced with key_mut
fn key_decor_mut(&mut self, key: &str) -> Option<&mut Decor> ⓘ
key_mut
Returns the decor associated with a given key of the table.