Struct toml_edit::Table [−][src]
pub struct Table { /* fields omitted */ }
Type representing a TOML non-inline table
Methods
impl Table
[src]
impl Table
pub fn new() -> Self
[src]
pub fn new() -> Self
Creates an empty table.
pub fn contains_key(&self, key: &str) -> bool
[src]
pub fn contains_key(&self, key: &str) -> bool
Returns true iff the table contains an item with the given key.
pub fn contains_table(&self, key: &str) -> bool
[src]
pub fn contains_table(&self, key: &str) -> bool
Returns true iff the table contains a table with the given key.
pub fn contains_value(&self, key: &str) -> bool
[src]
pub fn contains_value(&self, key: &str) -> bool
Returns true iff the table contains a value with the given key.
pub fn contains_array_of_tables(&self, key: &str) -> bool
[src]
pub fn contains_array_of_tables(&self, key: &str) -> bool
Returns true iff the table contains an array of tables with the given key.
pub fn iter(&self) -> Iter
[src]
pub fn iter(&self) -> Iter
Returns an iterator over all key/value pairs, including empty.
pub fn remove(&mut self, key: &str) -> Option<Item>
[src]
pub fn remove(&mut self, key: &str) -> Option<Item>
Removes an item given the key.
pub fn sort_values(&mut self)
[src]
pub fn sort_values(&mut self)
Sorts Key/Value Pairs of the table, doesn't affect subtables or subarrays.
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Returns the number of non-empty items in the table.
pub fn values_len(&self) -> usize
[src]
pub fn values_len(&self) -> usize
Returns the number of key/value pairs in the table.
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Returns true iff the table is empty.
pub fn entry<'a>(&'a mut self, key: &str) -> &'a mut Item
[src]
pub fn entry<'a>(&'a mut self, key: &str) -> &'a mut Item
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.
pub fn get<'a>(&'a self, key: &str) -> Option<&'a Item>
[src]
pub fn get<'a>(&'a self, key: &str) -> Option<&'a Item>
Returns an optional reference to an item given the key.
pub fn set_implicit(&mut self, implicit: bool)
[src]
pub fn set_implicit(&mut self, implicit: bool)
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]
impl Display for Table
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<'s> Index<&'s str> for Table
[src]
impl<'s> Index<&'s str> for Table
type Output = Item
The returned type after indexing.
fn index(&self, key: &'s str) -> &Item
[src]
fn index(&self, key: &'s str) -> &Item
Performs the indexing (container[index]
) operation.
impl<'s> IndexMut<&'s str> for Table
[src]
impl<'s> IndexMut<&'s str> for Table
fn index_mut(&mut self, key: &'s str) -> &mut Item
[src]
fn index_mut(&mut self, key: &'s str) -> &mut Item
Performs the mutable indexing (container[index]
) operation.
impl Clone for Table
[src]
impl Clone for Table
fn clone(&self) -> Table
[src]
fn clone(&self) -> Table
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Table
[src]
impl Debug for Table
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Default for Table
[src]
impl Default for Table
impl TableLike for Table
[src]
impl TableLike for Table
fn iter(&self) -> Iter
[src]
fn iter(&self) -> Iter
Returns an iterator over all subitems, including Item::None
.
fn get<'s>(&'s self, key: &str) -> Option<&'s Item>
[src]
fn get<'s>(&'s self, key: &str) -> Option<&'s Item>
Returns an optional reference to an item given the key.
fn len(&self) -> usize
[src]
fn len(&self) -> usize
Returns the number of nonempty items.
fn is_empty(&self) -> bool
[src]
fn is_empty(&self) -> bool
Returns true iff the table is empty.