Trait vsvg::DocumentTrait
source · pub trait DocumentTrait<L: LayerTrait<P, D>, P: PathTrait<D>, D: PathDataTrait>: Transforms {
Show 15 methods
// Required methods
fn layers(&self) -> &BTreeMap<LayerID, L>;
fn layers_mut(&mut self) -> &mut BTreeMap<LayerID, L>;
fn metadata(&self) -> &DocumentMetadata;
fn metadata_mut(&mut self) -> &mut DocumentMetadata;
// Provided methods
fn push_path(&mut self, id: LayerID, path: impl Into<P>) { ... }
fn try_get(&self, id: LayerID) -> Option<&L> { ... }
fn get_mut(&mut self, id: LayerID) -> &mut L { ... }
fn ensure_exists(&mut self, id: LayerID) { ... }
fn for_each<F>(&mut self, f: F)
where F: Fn(&mut L) { ... }
fn merge_layers(&mut self) { ... }
fn bounds(&self) -> Option<Rect> { ... }
fn stats(&self) -> BTreeMap<LayerID, LayerStats> { ... }
fn to_svg_string(&self) -> Result<String, Error> { ... }
fn to_svg(&self, writer: impl Write) -> Result<()> { ... }
fn to_svg_file(&self, file_path: impl AsRef<Path>) -> Result<()> { ... }
}
Required Methods§
fn layers(&self) -> &BTreeMap<LayerID, L>
fn layers_mut(&mut self) -> &mut BTreeMap<LayerID, L>
fn metadata(&self) -> &DocumentMetadata
fn metadata_mut(&mut self) -> &mut DocumentMetadata
Provided Methods§
fn push_path(&mut self, id: LayerID, path: impl Into<P>)
fn try_get(&self, id: LayerID) -> Option<&L>
fn get_mut(&mut self, id: LayerID) -> &mut L
fn ensure_exists(&mut self, id: LayerID)
fn for_each<F>(&mut self, f: F)
sourcefn merge_layers(&mut self)
fn merge_layers(&mut self)
Merge all existing layers into layer 0, if any.
fn bounds(&self) -> Option<Rect>
fn stats(&self) -> BTreeMap<LayerID, LayerStats>
fn to_svg_string(&self) -> Result<String, Error>
fn to_svg(&self, writer: impl Write) -> Result<()>
fn to_svg_file(&self, file_path: impl AsRef<Path>) -> Result<()>
Object Safety§
This trait is not object safe.