pub struct Tree {
pub size: Size,
pub view_box: ViewBox,
pub root: Node,
}Expand description
A nodes tree container.
Fields§
§size: SizeImage size.
Size of an image that should be created to fit the SVG.
width and height in SVG.
view_box: ViewBoxSVG viewbox.
Specifies which part of the SVG image should be rendered.
viewBox and preserveAspectRatio in SVG.
root: NodeThe root element of the SVG tree.
The root node is always Group.
Implementations§
source§impl Tree
impl Tree
sourcepub fn from_data(data: &[u8], opt: &Options<'_>) -> Result<Self, Error>
pub fn from_data(data: &[u8], opt: &Options<'_>) -> Result<Self, Error>
Parses Tree from an SVG data.
Can contain an SVG string or a gzip compressed data.
sourcepub fn from_str(text: &str, opt: &Options<'_>) -> Result<Self, Error>
pub fn from_str(text: &str, opt: &Options<'_>) -> Result<Self, Error>
Parses Tree from an SVG string.
sourcepub fn from_xmltree(
doc: &Document<'_>,
opt: &Options<'_>
) -> Result<Self, Error>
pub fn from_xmltree( doc: &Document<'_>, opt: &Options<'_> ) -> Result<Self, Error>
Parses Tree from roxmltree::Document.
sourcepub fn from_nested_svgtree(
doc: NestedSvgDocument,
opt: &Options<'_>
) -> Result<Self, Error>
pub fn from_nested_svgtree( doc: NestedSvgDocument, opt: &Options<'_> ) -> Result<Self, Error>
Parses Tree from svgtree::NestedSvgDocument.
sourcepub fn from_svgtree(doc: Document, opt: &Options<'_>) -> Result<Self, Error>
pub fn from_svgtree(doc: Document, opt: &Options<'_>) -> Result<Self, Error>
Parses Tree from the svgtree::Document.
An empty Tree will be returned on any error.
sourcepub fn node_by_id(&self, id: &str) -> Option<Node>
pub fn node_by_id(&self, id: &str) -> Option<Node>
Returns renderable node by ID.
If an empty ID is provided, than this method will always return None.
Even if tree has nodes with empty ID.
sourcepub fn ungroup_groups(root: Node, keep_named_groups: bool)
pub fn ungroup_groups(root: Node, keep_named_groups: bool)
Ungroups groups inside the root node.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Tree
impl !RefUnwindSafe for Tree
impl !Send for Tree
impl !Sync for Tree
impl Unpin for Tree
impl !UnwindSafe for Tree
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more