pub struct Tree { /* private fields */ }
Expand description
A nodes tree container.
Implementations
sourceimpl Tree
impl Tree
sourcepub fn from_data(data: &[u8], opt: &OptionsRef<'_>) -> Result<Self, Error>
pub fn from_data(data: &[u8], opt: &OptionsRef<'_>) -> 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: &OptionsRef<'_>) -> Result<Self, Error>
pub fn from_str(text: &str, opt: &OptionsRef<'_>) -> Result<Self, Error>
Parses Tree
from the SVG string.
sourcepub fn from_xmltree(
doc: &Document<'_>,
opt: &OptionsRef<'_>
) -> Result<Self, Error>
pub fn from_xmltree(
doc: &Document<'_>,
opt: &OptionsRef<'_>
) -> Result<Self, Error>
Parses Tree
from roxmltree::Document
.
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.
sourcepub fn to_string(&self, opt: &XmlOptions) -> String
pub fn to_string(&self, opt: &XmlOptions) -> String
Converts an SVG.
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 T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more