pub struct DialectLayers { /* private fields */ }Expand description
A report’s primary format layer and any nested or carried format layers.
Extra layers are unique by (format, instance). An extra layer for the
primary format has an instance that identifies it inside the containing
document. The wire names the primary explicitly, so the collection carries
its complete identity without an enclosing report’s format.
A read rejects a wire whose extra repeats a (format, instance) key, and
one whose extra carries the primary key. The key set on the wire is the
key set of the value, so no layer is silently discarded or overwritten.
Implementations§
Source§impl DialectLayers
impl DialectLayers
Sourcepub fn of(primary: DialectMatch) -> Self
pub fn of(primary: DialectMatch) -> Self
Constructs dialect layers with one primary and no extra layers.
Sourcepub fn insert(&mut self, layer: DialectMatch) -> Result<(), DialectLayerError>
pub fn insert(&mut self, layer: DialectMatch) -> Result<(), DialectLayerError>
Inserts a layer keyed by (format, instance).
The first layer for a key remains authoritative. A duplicate is returned unchanged so its producer can report the collision.
Sourcepub fn with(self, layer: DialectMatch) -> Result<Self, DialectLayerError>
pub fn with(self, layer: DialectMatch) -> Result<Self, DialectLayerError>
Adds a layer, returning it unchanged when its key is occupied.
Sourcepub fn primary(&self) -> &DialectMatch
pub fn primary(&self) -> &DialectMatch
Returns the report’s primary format layer.
Sourcepub fn iter(&self) -> impl Iterator<Item = &DialectMatch>
pub fn iter(&self) -> impl Iterator<Item = &DialectMatch>
Iterates over the primary layer followed by every extra layer.