Struct toml_edit::Table
[−]
[src]
pub struct Table { /* fields omitted */ }Type representing a TOML non-inline table
Methods
impl Table[src]
fn new() -> Self[src]
Creates an empty table.
fn contains_key(&self, key: &str) -> bool[src]
Returns true iff the table contains an item with the given key.
fn contains_table(&self, key: &str) -> bool[src]
Returns true iff the table contains a table with the given key.
fn contains_value(&self, key: &str) -> bool[src]
Returns true iff the table contains a value with the given key.
fn contains_array_of_tables(&self, key: &str) -> bool[src]
Returns true iff the table contains an array of tables with the given key.
fn iter(&self) -> Iter[src]
Returns an iterator over all key/value pairs, including empty.
fn remove(&mut self, key: &str) -> Option<Item>[src]
Removes an item given the key.
fn sort_values(&mut self)[src]
Sorts Key/Value Pairs of the table, doesn't affect subtables or subarrays.
fn len(&self) -> usize[src]
Returns the number of non-empty items in the table.
fn values_len(&self) -> usize[src]
Returns the number of key/value pairs in the table.
fn is_empty(&self) -> bool[src]
Returns true iff the table is empty.
fn entry<'a>(&'a mut self, key: &str) -> &'a mut Item[src]
Given the key, return a mutable reference to the value.
If there is no entry associated with the given key in the table,
a Item::None value will be inserted.
To insert to table, use entry to return a mutable reference
and set it to the appropriate value.
fn get<'a>(&'a self, key: &str) -> Option<&'a Item>[src]
Returns an optional reference to an item given the key.
fn set_implicit(&mut self, implicit: bool)[src]
If a table has no key/value pairs and implicit, it will not be displayed.
Examples
[target."x86_64/windows.json".dependencies]
In the document above, tables target and target."x86_64/windows.json" are implicit.
let mut doc = "[a]\n[a.b]\n".parse::<Document>().expect("invalid toml"); doc["a"].as_table_mut().unwrap().set_implicit(true); assert_eq!(doc.to_string(), "[a.b]\n");
Trait Implementations
impl Display for Table[src]
fn fmt(&self, f: &mut Formatter) -> Result[src]
Formats the value using the given formatter. Read more
impl Clone for Table[src]
fn clone(&self) -> Table[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl Debug for Table[src]
impl Default for Table[src]
impl TableLike for Table[src]
fn iter(&self) -> Iter[src]
Returns an iterator over all subitems, including Item::None.
fn get<'s>(&'s self, key: &str) -> Option<&'s Item>[src]
Returns an optional reference to an item given the key.
fn len(&self) -> usize[src]
Returns the number of nonempty items.
fn is_empty(&self) -> bool[src]
Returns true iff the table is empty.
impl<'s> Index<&'s str> for Table[src]
type Output = Item
The returned type after indexing.
fn index(&self, key: &'s str) -> &Item[src]
Performs the indexing (container[index]) operation.