[][src]Struct rsvg_internals::document::Document

pub struct Document {
    tree: Node<NodeData>,
    ids: HashMap<String, Node<NodeData>>,
    externs: RefCell<Resources>,
    images: RefCell<Images>,
    load_options: LoadOptions,
    stylesheets: Vec<Stylesheet>,
}

A loaded SVG file and its derived data.

Fields

tree: Node<NodeData>

Tree of nodes; the root is guaranteed to be an <svg> element.

ids: HashMap<String, Node<NodeData>>

Mapping from id attributes to nodes.

externs: RefCell<Resources>

SVG documents referenced from this document.

images: RefCell<Images>

Image resources referenced from this document.

load_options: LoadOptions

Used to load referenced resources.

stylesheets: Vec<Stylesheet>

Stylesheets defined in the document

Methods

impl Document[src]

pub fn load_from_stream(
    load_options: &LoadOptions,
    stream: &InputStream,
    cancellable: Option<&Cancellable>
) -> Result<Document, LoadingError>
[src]

Constructs a Document by loading it from a stream.

pub fn root(&self) -> Node<NodeData>[src]

Gets the root node. This is guaranteed to be an <svg> element.

pub fn lookup(
    &self,
    fragment: &Fragment
) -> Result<Node<NodeData>, LoadingError>
[src]

Looks up an element node by its URL.

This is also used to find elements in referenced resources, as in `xlink:href="subresource.svg#element_name".

pub fn lookup_node_by_id(&self, id: &str) -> Option<Node<NodeData>>[src]

Looks up a node only in this document fragment by its id attribute.

pub fn lookup_image(
    &self,
    href: &str
) -> Result<SharedImageSurface, LoadingError>
[src]

Loads an image by URL, or returns a pre-loaded one.

pub fn cascade(&mut self, extra: &[Stylesheet])[src]

Runs the CSS cascade on the document tree

This uses the default UserAgent stylesheet, the document's internal stylesheets, plus an extra set of stylesheets supplied by the caller.

Auto Trait Implementations

impl !RefUnwindSafe for Document

impl !Send for Document

impl !Sync for Document

impl Unpin for Document

impl !UnwindSafe for Document

Blanket Implementations

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

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

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

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

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<V, T> VZip<V> for T where
    V: MultiLane<T>,