pub trait TableLike: Sealed {
Show 17 methods
fn iter(&self) -> Iter<'_>;
fn iter_mut(&mut self) -> IterMut<'_>;
fn clear(&mut self);
fn get<'s>(&'s self, key: &str) -> Option<&'s Item>;
fn get_mut<'s>(&'s mut self, key: &str) -> Option<&'s 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_decor_mut(&mut self, key: &str) -> Option<&mut Decor>;
fn key_decor(&self, key: &str) -> Option<&Decor>;
fn len(&self) -> usize { ... }
fn is_empty(&self) -> bool { ... }
}
Expand description
This trait represents either a Table
, or an InlineTable
.
Required methods
Returns an mutable iterator over all key/value pairs, including empty.
Clears the table, removing all key-value pairs. Keeps the allocated memory for reuse.
Returns an optional reference to an item given the key.
Returns an optional mutable reference to an item given the key.
fn contains_key(&self, key: &str) -> bool
fn contains_key(&self, key: &str) -> bool
Returns true iff the table contains an item with the given key.
Inserts a key-value pair into the map.
Get key/values for values that are visually children of this table
For example, this will return dotted keys
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
Check if this is a wrapper for dotted keys, rather than a standard table
fn key_decor_mut(&mut self, key: &str) -> Option<&mut Decor>
fn key_decor_mut(&mut self, key: &str) -> Option<&mut Decor>
Returns the decor associated with a given key of the table.