diff options
author | Federico Mena Quintero <federico@gnome.org> | 2022-08-29 12:01:39 -0500 |
---|---|---|
committer | Federico Mena Quintero <federico@gnome.org> | 2022-08-29 12:01:39 -0500 |
commit | 24bf24a8bc1c3b7e02380406d0b65febdd98dd1b (patch) | |
tree | 05ea9bdead935be15487d7a034a550290f28ebe9 | |
parent | f5bda04dabf4c52f0c894e0a53c84023c00498ed (diff) | |
download | librsvg-24bf24a8bc1c3b7e02380406d0b65febdd98dd1b.tar.gz |
Add docs for fields of DocumentBuilder.
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/738>
-rw-r--r-- | src/document.rs | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/document.rs b/src/document.rs index 21252e40..a297477b 100644 --- a/src/document.rs +++ b/src/document.rs @@ -92,7 +92,7 @@ pub struct Document { /// Used to load referenced resources. load_options: LoadOptions, - /// Stylesheets defined in the document + /// Stylesheets defined in the document. stylesheets: Vec<Stylesheet>, } @@ -492,11 +492,31 @@ impl NodeStack { } } +/// Used to build a tree of SVG nodes while an XML document is being read. +/// +/// This struct holds the document-related state while loading an SVG document from XML: +/// the loading options, the partially-built tree of nodes, the CSS stylesheets that +/// appear while loading the document. +/// +/// The XML loader asks a `DocumentBuilder` to +/// [`append_element`][DocumentBuilder::append_element], +/// [`append_characters`][DocumentBuilder::append_characters], etc. When all the XML has +/// been consumed, the caller can use [`build`][DocumentBuilder::build] to get a +/// fully-loaded [`Document`]. pub struct DocumentBuilder { + /// Metadata for the document's lifetime. session: Session, + + /// Loading options; mainly the URL resolver. load_options: LoadOptions, + + /// Root node of the tree. tree: Option<Node>, + + /// Mapping from `id` attributes to nodes. ids: HashMap<String, Node>, + + /// Stylesheets defined in the document. stylesheets: Vec<Stylesheet>, } |