[librsvg: 1/17] Add docs for fields of DocumentBuilder.




commit 24bf24a8bc1c3b7e02380406d0b65febdd98dd1b
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon Aug 29 12:01:39 2022 -0500

    Add docs for fields of DocumentBuilder.
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/738>

 src/document.rs | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
---
diff --git a/src/document.rs b/src/document.rs
index 21252e407..a297477be 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>,
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]