Skip to main content

MappingView

Trait MappingView 

Source
pub trait MappingView {
    // Required methods
    fn get(&self, key: &dyn AsYaml) -> Option<YamlNode>;
    fn iter<'a>(&'a self) -> Box<dyn Iterator<Item = (YamlNode, YamlNode)> + 'a>;

    // Provided methods
    fn contains_key(&self, key: &dyn AsYaml) -> bool { ... }
    fn len(&self) -> usize { ... }
    fn is_empty(&self) -> bool { ... }
    fn keys<'a>(&'a self) -> Box<dyn Iterator<Item = YamlNode> + 'a> { ... }
    fn values<'a>(&'a self) -> Box<dyn Iterator<Item = YamlNode> + 'a> { ... }
}
Expand description

A read-only “view” of a YAML mapping, implemented by both the CST Mapping and the alias/merge-key–resolving MergedMapping.

See the module docs for an overview and example.

Required Methods§

Source

fn get(&self, key: &dyn AsYaml) -> Option<YamlNode>

Look up the value associated with key.

Key matching is semantic (quoting style is ignored), so "foo", 'foo', and foo all match the scalar foo.

Source

fn iter<'a>(&'a self) -> Box<dyn Iterator<Item = (YamlNode, YamlNode)> + 'a>

Iterate over (key, value) pairs.

Provided Methods§

Source

fn contains_key(&self, key: &dyn AsYaml) -> bool

Returns true if get would return Some for key.

Source

fn len(&self) -> usize

Number of entries visible through this view.

Source

fn is_empty(&self) -> bool

Returns true if the view has no entries.

Source

fn keys<'a>(&'a self) -> Box<dyn Iterator<Item = YamlNode> + 'a>

Iterate over the keys.

Source

fn values<'a>(&'a self) -> Box<dyn Iterator<Item = YamlNode> + 'a>

Iterate over the values.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§