[][src]Struct usvg::Tree

pub struct Tree { /* fields omitted */ }

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

impl Clone for Tree[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl !Send for Tree

impl !Sync for Tree

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]