pub struct Document<'input> {
    nodes: Vec<NodeData>,
    attrs: Vec<Attribute<'input>>,
    links: HashMap<String, NodeId>,
}Expand description
An SVG tree container.
Contains only element and text nodes.
Text nodes are present only inside the text element.
Fields§
§nodes: Vec<NodeData>§attrs: Vec<Attribute<'input>>§links: HashMap<String, NodeId>Implementations§
Source§impl<'input> Document<'input>
 
impl<'input> Document<'input>
Sourcepub fn parse_tree(
    xml: &Document<'input>,
    injected_stylesheet: Option<&'input str>,
) -> Result<Document<'input>, Error>
 
pub fn parse_tree( xml: &Document<'input>, injected_stylesheet: Option<&'input str>, ) -> Result<Document<'input>, Error>
Parses a Document from a roxmltree::Document.
pub(crate) fn append(&mut self, parent_id: NodeId, kind: NodeKind) -> NodeId
fn append_attribute( &mut self, name: AId, value: StringStorage<'input>, important: bool, )
Source§impl<'input> Document<'input>
 
impl<'input> Document<'input>
Sourcepub fn root_element<'a>(&'a self) -> SvgNode<'a, 'input>
 
pub fn root_element<'a>(&'a self) -> SvgNode<'a, 'input>
Returns the root element.
Sourcepub fn descendants<'a>(&'a self) -> Descendants<'a, 'input> ⓘ
 
pub fn descendants<'a>(&'a self) -> Descendants<'a, 'input> ⓘ
Returns an iterator over document’s descendant nodes.
Shorthand for doc.root().descendants().
Sourcepub fn element_by_id<'a>(&'a self, id: &str) -> Option<SvgNode<'a, 'input>>
 
pub fn element_by_id<'a>(&'a self, id: &str) -> Option<SvgNode<'a, 'input>>
Returns an element by ID.
Unlike the Descendants iterator, this is just a HashMap lookup.
Meaning it’s way faster.
fn get<'a>(&'a self, id: NodeId) -> SvgNode<'a, 'input>
Trait Implementations§
Auto Trait Implementations§
impl<'input> Freeze for Document<'input>
impl<'input> RefUnwindSafe for Document<'input>
impl<'input> Send for Document<'input>
impl<'input> Sync for Document<'input>
impl<'input> Unpin for Document<'input>
impl<'input> UnwindSafe for Document<'input>
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