Struct norad::LayerContents
source · pub struct LayerContents { /* private fields */ }
Expand description
The ordered list of Layer
objects within a UFO.
A layer set always includes a default layer, and may also include additional layers.
Corresponds to layercontents.plist
.
Implementations§
source§impl LayerContents
impl LayerContents
sourcepub fn get_mut(&mut self, name: &str) -> Option<&mut Layer>
pub fn get_mut(&mut self, name: &str) -> Option<&mut Layer>
Returns a mutable reference to a layer, by name.
sourcepub fn default_layer(&self) -> &Layer
pub fn default_layer(&self) -> &Layer
Returns a reference to the default layer.
sourcepub fn default_layer_mut(&mut self) -> &mut Layer
pub fn default_layer_mut(&mut self) -> &mut Layer
Returns a mutable reference to the default layer.
sourcepub fn iter_mut(&mut self) -> impl Iterator<Item = &mut Layer>
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut Layer>
Returns a mutable iterator over all layers.
sourcepub fn names(&self) -> impl Iterator<Item = &Name>
pub fn names(&self) -> impl Iterator<Item = &Name>
Returns an iterator over the names of all layers.
sourcepub fn new_layer(&mut self, name: &str) -> Result<&mut Layer, NamingError>
pub fn new_layer(&mut self, name: &str) -> Result<&mut Layer, NamingError>
Returns a new layer with the given name.
sourcepub fn get_or_create_layer(
&mut self,
name: &str
) -> Result<&mut Layer, NamingError>
pub fn get_or_create_layer( &mut self, name: &str ) -> Result<&mut Layer, NamingError>
Returns a mutable reference to a layer, by name, creating the layer if it doesn’t exist
sourcepub fn remove(&mut self, name: &str) -> Option<Layer>
pub fn remove(&mut self, name: &str) -> Option<Layer>
Remove a layer.
The default layer cannot be removed.
sourcepub fn rename_layer(
&mut self,
old: &str,
new: &str,
overwrite: bool
) -> Result<(), NamingError>
pub fn rename_layer( &mut self, old: &str, new: &str, overwrite: bool ) -> Result<(), NamingError>
Rename a layer.
If overwrite
is true, and a layer with the new name exists, it will
be replaced.
Returns an error if overwrite
is false but a layer with the new
name exists, if no layer with the old name exists, if the new name
is not a valid Name
or when anything but the default layer should
be renamed to “public.default”.
sourcepub fn retain<F>(&mut self, predicate: F)
pub fn retain<F>(&mut self, predicate: F)
Retains the default layer, and any layers allowed by the predicate.
In other words, remove all layers l
for which predicate(&l)
returns false
.
This method operates in place, visiting each layer exactly once in the
original order, and preserves the order of the retained layers.
For more information, see Vec::retain
.
sourcepub fn remove_empty_layers(&mut self)
pub fn remove_empty_layers(&mut self)
Removes any layers that contain no glyphs
Trait Implementations§
source§impl Clone for LayerContents
impl Clone for LayerContents
source§fn clone(&self) -> LayerContents
fn clone(&self) -> LayerContents
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more