[−][src]Struct toml_edit::Table
Type representing a TOML non-inline table
Methods
impl Table[src]
pub fn new() -> Self[src]
Creates an empty table.
pub fn contains_key(&self, key: &str) -> bool[src]
Returns true iff the table contains an item with the given key.
pub fn contains_table(&self, key: &str) -> bool[src]
Returns true iff the table contains a table with the given key.
pub fn contains_value(&self, key: &str) -> bool[src]
Returns true iff the table contains a value with the given key.
pub fn contains_array_of_tables(&self, key: &str) -> bool[src]
Returns true iff the table contains an array of tables with the given key.
pub fn iter(&self) -> Iter[src]
Returns an iterator over all key/value pairs, including empty.
pub fn remove(&mut self, key: &str) -> Option<Item>[src]
Removes an item given the key.
pub fn sort_values(&mut self)[src]
Sorts Key/Value Pairs of the table, doesn't affect subtables or subarrays.
pub fn len(&self) -> usize[src]
Returns the number of non-empty items in the table.
pub fn values_len(&self) -> usize[src]
Returns the number of key/value pairs in the table.
pub fn is_empty(&self) -> bool[src]
Returns true iff the table is empty.
pub 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.
pub fn get<'a>(&'a self, key: &str) -> Option<&'a Item>[src]
Returns an optional reference to an item given the key.
pub 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 Clone for Table[src]
impl Debug for Table[src]
impl Default for Table[src]
impl Display for Table[src]
impl<'s> Index<&'s str> for Table[src]
impl<'s> IndexMut<&'s str> for Table[src]
impl TableLike for Table[src]
Auto Trait Implementations
impl RefUnwindSafe for Table
impl Send for Table
impl Sync for Table
impl Unpin for Table
impl UnwindSafe for Table
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,