[librsvg: 7/17] Some more docstrings for DocumentBuilder
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 7/17] Some more docstrings for DocumentBuilder
- Date: Tue, 30 Aug 2022 02:13:12 +0000 (UTC)
commit 98f0643d999ca8c1522f7fdf4e411a20bac84421
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Aug 29 15:27:38 2022 -0500
Some more docstrings for DocumentBuilder
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/738>
src/document.rs | 12 ++++++++++++
1 file changed, 12 insertions(+)
---
diff --git a/src/document.rs b/src/document.rs
index d392adef5..bc9ded7db 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]