pub struct Tree { /* private fields */ }
Expand description
A nodes tree container.
Implementations
sourceimpl 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 the 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 the SVG string.
sourcepub fn from_dom(doc: Document, opt: &Options) -> Self
pub fn from_dom(doc: Document, opt: &Options) -> Self
Parses Tree
from the svgdom::Document
.
An empty Tree
will be returned on any error.
sourcepub fn from_file<P: AsRef<Path>>(path: P, opt: &Options) -> Result<Self, Error>
pub fn from_file<P: AsRef<Path>>(path: P, opt: &Options) -> Result<Self, Error>
Parses Tree
from the file.
sourcepub fn is_in_defs(&self, node: &Node) -> bool
pub fn is_in_defs(&self, node: &Node) -> bool
Checks that node
is part of the Defs
children.
sourcepub fn append_to_defs(&mut self, kind: NodeKind) -> Node
pub fn append_to_defs(&mut self, kind: NodeKind) -> Node
Appends NodeKind
to the Defs
node.
sourcepub fn defs_by_id(&self, id: &str) -> Option<Node>
pub fn defs_by_id(&self, id: &str) -> Option<Node>
Returns defs
child node by ID.
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.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Tree
impl !Send for Tree
impl !Sync for Tree
impl Unpin for Tree
impl !UnwindSafe for Tree
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more