[−][src]Struct usvg::Tree
A nodes tree container.
Methods
impl Tree
[src]
pub fn from_data(data: &[u8], opt: &Options) -> Result<Self, Error>
[src]
Parses Tree
from the SVG data.
Can contain an SVG string or a gzip compressed data.
pub fn from_str(text: &str, opt: &Options) -> Result<Self, Error>
[src]
Parses Tree
from the SVG string.
pub fn from_dom(doc: Document, opt: &Options) -> Result<Self, Error>
[src]
Parses Tree
from the svgdom::Document
.
An empty Tree
will be returned on any error.
pub fn from_file<P: AsRef<Path>>(path: P, opt: &Options) -> Result<Self, Error>
[src]
Parses Tree
from the file.
pub fn create(svg: Svg) -> Self
[src]
Creates a new Tree
.
pub fn root(&self) -> Node
[src]
Returns the Svg
node.
pub fn svg_node(&self) -> Ref<Svg>
[src]
Returns the Svg
node value.
pub fn defs(&self) -> Node
[src]
Returns the Defs
node.
pub fn is_in_defs(&self, node: &Node) -> bool
[src]
Checks that node
is part of the Defs
children.
pub fn append_to_defs(&mut self, kind: NodeKind) -> Node
[src]
Appends NodeKind
to the Defs
node.
pub fn defs_by_id(&self, id: &str) -> Option<Node>
[src]
Returns defs
child node by ID.
pub fn node_by_id(&self, id: &str) -> Option<Node>
[src]
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.
pub fn to_svgdom(&self) -> Document
[src]
Converts the document to svgdom::Document
.
Used to save document to file for debug purposes.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,