Struct toml_edit::InlineTable
source · pub struct InlineTable { /* private fields */ }
Expand description
Type representing a TOML inline table,
payload of the Value::InlineTable
variant
Implementations§
source§impl InlineTable
impl InlineTable
Constructors
See also FromIterator
sourcepub fn into_table(self) -> Table
pub fn into_table(self) -> Table
Convert to a table
source§impl InlineTable
impl InlineTable
Formatting
sourcepub fn get_values(&self) -> Vec<(Vec<&Key>, &Value)>
pub 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
sourcepub fn sort_values(&mut self)
pub fn sort_values(&mut self)
Sorts the key/value pairs by key.
sourcepub fn sort_values_by<F>(&mut self, compare: F)
pub fn sort_values_by<F>(&mut self, compare: F)
Sort Key/Value Pairs of the table using the using the comparison function compare
.
The comparison function receives two key and value pairs to compare (you can sort by keys or values or their combination as needed).
sourcepub fn set_dotted(&mut self, yes: bool)
pub fn set_dotted(&mut self, yes: bool)
Change this table’s dotted status
sourcepub fn is_dotted(&self) -> bool
pub fn is_dotted(&self) -> bool
Check if this is a wrapper for dotted keys, rather than a standard table
sourcepub fn key_decor_mut(&mut self, key: &str) -> Option<&mut Decor>
pub fn key_decor_mut(&mut self, key: &str) -> Option<&mut Decor>
Returns the decor associated with a given key of the table.
sourcepub fn key_decor(&self, key: &str) -> Option<&Decor>
pub fn key_decor(&self, key: &str) -> Option<&Decor>
Returns the decor associated with a given key of the table.
sourcepub fn set_preamble(&mut self, preamble: impl Into<RawString>)
pub fn set_preamble(&mut self, preamble: impl Into<RawString>)
Set whitespace after before element
source§impl InlineTable
impl InlineTable
sourcepub fn iter(&self) -> InlineTableIter<'_>
pub fn iter(&self) -> InlineTableIter<'_>
Returns an iterator over key/value pairs.
sourcepub fn iter_mut(&mut self) -> InlineTableIterMut<'_>
pub fn iter_mut(&mut self) -> InlineTableIterMut<'_>
Returns an iterator over key/value pairs.
sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clears the table, removing all key-value pairs. Keeps the allocated memory for reuse.
sourcepub fn entry(&mut self, key: impl Into<InternalString>) -> InlineEntry<'_>
pub fn entry(&mut self, key: impl Into<InternalString>) -> InlineEntry<'_>
Gets the given key’s corresponding entry in the Table for in-place manipulation.
sourcepub fn entry_format<'a>(&'a mut self, key: &Key) -> InlineEntry<'a>
pub fn entry_format<'a>(&'a mut self, key: &Key) -> InlineEntry<'a>
Gets the given key’s corresponding entry in the Table for in-place manipulation.
sourcepub fn get(&self, key: &str) -> Option<&Value>
pub fn get(&self, key: &str) -> Option<&Value>
Return an optional reference to the value at the given the key.
sourcepub fn get_mut(&mut self, key: &str) -> Option<&mut Value>
pub fn get_mut(&mut self, key: &str) -> Option<&mut Value>
Return an optional mutable reference to the value at the given the key.
sourcepub fn get_key_value<'a>(&'a self, key: &str) -> Option<(&'a Key, &'a Item)>
pub 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.
sourcepub fn get_key_value_mut<'a>(
&'a mut self,
key: &str,
) -> Option<(KeyMut<'a>, &'a mut Item)>
pub 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.
sourcepub fn contains_key(&self, key: &str) -> bool
pub fn contains_key(&self, key: &str) -> bool
Returns true iff the table contains given key.
sourcepub fn get_or_insert<V: Into<Value>>(
&mut self,
key: impl Into<InternalString>,
value: V,
) -> &mut Value
pub fn get_or_insert<V: Into<Value>>( &mut self, key: impl Into<InternalString>, value: V, ) -> &mut Value
Inserts a key/value pair if the table does not contain the key. Returns a mutable reference to the corresponding value.
sourcepub fn insert(
&mut self,
key: impl Into<InternalString>,
value: Value,
) -> Option<Value>
pub fn insert( &mut self, key: impl Into<InternalString>, value: Value, ) -> Option<Value>
Inserts a key-value pair into the map.
sourcepub fn insert_formatted(&mut self, key: &Key, value: Value) -> Option<Value>
pub fn insert_formatted(&mut self, key: &Key, value: Value) -> Option<Value>
Inserts a key-value pair into the map.
Trait Implementations§
source§impl Clone for InlineTable
impl Clone for InlineTable
source§fn clone(&self) -> InlineTable
fn clone(&self) -> InlineTable
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for InlineTable
impl Debug for InlineTable
source§impl Default for InlineTable
impl Default for InlineTable
source§fn default() -> InlineTable
fn default() -> InlineTable
source§impl Display for InlineTable
impl Display for InlineTable
source§impl<K: Into<Key>, V: Into<Value>> Extend<(K, V)> for InlineTable
impl<K: Into<Key>, V: Into<Value>> Extend<(K, V)> for InlineTable
source§fn extend<T: IntoIterator<Item = (K, V)>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = (K, V)>>(&mut self, iter: T)
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl From<InlineTable> for Value
impl From<InlineTable> for Value
source§fn from(table: InlineTable) -> Self
fn from(table: InlineTable) -> Self
source§impl<K: Into<Key>, V: Into<Value>> FromIterator<(K, V)> for InlineTable
impl<K: Into<Key>, V: Into<Value>> FromIterator<(K, V)> for InlineTable
source§impl<'s> Index<&'s str> for InlineTable
impl<'s> Index<&'s str> for InlineTable
source§impl<'s> IndexMut<&'s str> for InlineTable
impl<'s> IndexMut<&'s str> for InlineTable
source§impl<'s> IntoIterator for &'s InlineTable
impl<'s> IntoIterator for &'s InlineTable
source§impl IntoIterator for InlineTable
impl IntoIterator for InlineTable
source§impl TableLike for InlineTable
impl TableLike for InlineTable
source§fn iter_mut(&mut self) -> IterMut<'_>
fn iter_mut(&mut self) -> IterMut<'_>
source§fn clear(&mut self)
fn clear(&mut self)
source§fn entry<'a>(&'a mut self, key: &str) -> Entry<'a>
fn entry<'a>(&'a mut self, key: &str) -> Entry<'a>
source§fn entry_format<'a>(&'a mut self, key: &Key) -> Entry<'a>
fn entry_format<'a>(&'a mut self, key: &Key) -> Entry<'a>
source§fn get<'s>(&'s self, key: &str) -> Option<&'s Item>
fn get<'s>(&'s self, key: &str) -> Option<&'s Item>
source§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>
source§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)>
source§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)>
source§fn contains_key(&self, key: &str) -> bool
fn contains_key(&self, key: &str) -> bool
source§fn insert(&mut self, key: &str, value: Item) -> Option<Item>
fn insert(&mut self, key: &str, value: Item) -> Option<Item>
source§fn get_values(&self) -> Vec<(Vec<&Key>, &Value)>
fn get_values(&self) -> Vec<(Vec<&Key>, &Value)>
source§fn sort_values(&mut self)
fn sort_values(&mut self)
source§fn set_dotted(&mut self, yes: bool)
fn set_dotted(&mut self, yes: bool)
source§fn is_dotted(&self) -> bool
fn is_dotted(&self) -> bool
source§fn key_decor_mut(&mut self, key: &str) -> Option<&mut Decor>
fn key_decor_mut(&mut self, key: &str) -> Option<&mut Decor>
Auto Trait Implementations§
impl Freeze for InlineTable
impl RefUnwindSafe for InlineTable
impl Send for InlineTable
impl Sync for InlineTable
impl Unpin for InlineTable
impl UnwindSafe for InlineTable
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)