Type Alias toml::value::Table

source ·
pub type Table = Map<String, Value>;
Expand description

Type representing a TOML table, payload of the Value::Table variant. By default it is backed by a BTreeMap, enable the preserve_order feature to use a LinkedHashMap instead.

Aliased Type§

struct Table { /* private fields */ }

Implementations§

source§

impl Map<String, Value>

source

pub fn new() -> Self

Makes a new empty Map.

source

pub fn with_capacity(capacity: usize) -> Self

Makes a new empty Map with the given initial capacity.

source

pub fn clear(&mut self)

Clears the map, removing all values.

source

pub fn get<Q>(&self, key: &Q) -> Option<&Value>where String: Borrow<Q>, Q: Ord + Eq + Hash + ?Sized,

Returns a reference to the value corresponding to the key.

The key may be any borrowed form of the map’s key type, but the ordering on the borrowed form must match the ordering on the key type.

source

pub fn contains_key<Q>(&self, key: &Q) -> boolwhere String: Borrow<Q>, Q: Ord + Eq + Hash + ?Sized,

Returns true if the map contains a value for the specified key.

The key may be any borrowed form of the map’s key type, but the ordering on the borrowed form must match the ordering on the key type.

source

pub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut Value>where String: Borrow<Q>, Q: Ord + Eq + Hash + ?Sized,

Returns a mutable reference to the value corresponding to the key.

The key may be any borrowed form of the map’s key type, but the ordering on the borrowed form must match the ordering on the key type.

source

pub fn insert(&mut self, k: String, v: Value) -> Option<Value>

Inserts a key-value pair into the map.

If the map did not have this key present, None is returned.

If the map did have this key present, the value is updated, and the old value is returned. The key is not updated, though; this matters for types that can be == without being identical.

source

pub fn remove<Q>(&mut self, key: &Q) -> Option<Value>where String: Borrow<Q>, Q: Ord + Eq + Hash + ?Sized,

Removes a key from the map, returning the value at the key if the key was previously in the map.

The key may be any borrowed form of the map’s key type, but the ordering on the borrowed form must match the ordering on the key type.

source

pub fn entry<S>(&mut self, key: S) -> Entry<'_>where S: Into<String>,

Gets the given key’s corresponding entry in the map for in-place manipulation.

source

pub fn len(&self) -> usize

Returns the number of elements in the map.

source

pub fn is_empty(&self) -> bool

Returns true if the map contains no elements.

source

pub fn iter(&self) -> Iter<'_>

Gets an iterator over the entries of the map.

source

pub fn iter_mut(&mut self) -> IterMut<'_>

Gets a mutable iterator over the entries of the map.

source

pub fn keys(&self) -> Keys<'_>

Gets an iterator over the keys of the map.

source

pub fn values(&self) -> Values<'_>

Gets an iterator over the values of the map.

Trait Implementations§

source§

impl Clone for Map<String, Value>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Map<String, Value>

source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Default for Map<String, Value>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for Map<String, Value>

source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Extend<(String, Value)> for Map<String, Value>

source§

fn extend<T>(&mut self, iter: T)where T: IntoIterator<Item = (String, Value)>,

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl FromIterator<(String, Value)> for Map<String, Value>

source§

fn from_iter<T>(iter: T) -> Selfwhere T: IntoIterator<Item = (String, Value)>,

Creates a value from an iterator. Read more
source§

impl<'a, Q> Index<&'a Q> for Map<String, Value>where String: Borrow<Q>, Q: Ord + Eq + Hash + ?Sized,

Access an element of this map. Panics if the given key is not present in the map.

§

type Output = Value

The returned type after indexing.
source§

fn index(&self, index: &Q) -> &Value

Performs the indexing (container[index]) operation. Read more
source§

impl<'a, Q> IndexMut<&'a Q> for Map<String, Value>where String: Borrow<Q>, Q: Ord + Eq + Hash + ?Sized,

Mutably access an element of this map. Panics if the given key is not present in the map.

source§

fn index_mut(&mut self, index: &Q) -> &mut Value

Performs the mutable indexing (container[index]) operation. Read more
source§

impl IntoIterator for Map<String, Value>

§

type Item = (String, Value)

The type of the elements being iterated over.
§

type IntoIter = IntoIter

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl PartialEq<Map<String, Value>> for Map<String, Value>

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Map<String, Value>

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>where S: Serializer,

Serialize this value into the given Serde serializer. Read more