summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@gnome.org>2022-08-29 15:27:38 -0500
committerFederico Mena Quintero <federico@gnome.org>2022-08-29 15:27:38 -0500
commit98f0643d999ca8c1522f7fdf4e411a20bac84421 (patch)
tree2964a1aa99446f0b24a1adbdaec9b8fae75d8424
parent87087fd31d4cae95da3a33cef15c95276958bbc6 (diff)
downloadlibrsvg-98f0643d999ca8c1522f7fdf4e411a20bac84421.tar.gz
Some more docstrings for DocumentBuilder
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/738>
-rw-r--r--src/document.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/document.rs b/src/document.rs
index d392adef..bc9ded7d 100644
--- a/src/document.rs
+++ b/src/document.rs
@@ -562,6 +562,17 @@ impl DocumentBuilder {
Ok(())
}
+ /// Creates an element of the specified `name` as a child of `parent`.
+ ///
+ /// This is the main function to create new SVG elements while parsing XML.
+ ///
+ /// `name` is the XML element's name, for example `rect`.
+ ///
+ /// `attrs` has the XML element's attributes, e.g. cx/cy/r for `<circle cx="0" cy="0"
+ /// r="5">`.
+ ///
+ /// If `parent` is `None` it means that we are creating the root node in the tree of
+ /// elements. The code will later validate that this is indeed an `<svg>` element.
pub fn append_element(
&mut self,
name: &QualName,
@@ -600,6 +611,7 @@ impl DocumentBuilder {
}
}
+ /// Creates a node for an XML text element as a child of `parent`.
pub fn append_characters(&mut self, text: &str, parent: &mut Node) {
if !text.is_empty() {
self.append_chars_to_parent(text, parent);