[librsvg] Document the Handle struct
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] Document the Handle struct
- Date: Tue, 5 May 2020 17:09:01 +0000 (UTC)
commit 7ea3e12190f3650f142cb4f6f58450b9bdf87e39
Author: Federico Mena Quintero <federico gnome org>
Date: Mon May 4 19:05:04 2020 -0500
Document the Handle struct
rsvg_internals/src/handle.rs | 11 +++++++++++
1 file changed, 11 insertions(+)
---
diff --git a/rsvg_internals/src/handle.rs b/rsvg_internals/src/handle.rs
index 5d86d2fa..42b24de1 100644
--- a/rsvg_internals/src/handle.rs
+++ b/rsvg_internals/src/handle.rs
@@ -69,11 +69,18 @@ impl LoadOptions {
}
}
+/// Main handle to an SVG document.
+///
+/// This is the main object in librsvg. It gets created with the [`from_stream`] method
+/// and then provides access to all the primitives needed to implement the public APIs.
+///
+/// [`from_stream`]: #method.from_stream
pub struct Handle {
document: Document,
}
impl Handle {
+ /// Loads an SVG document into a `Handle`.
pub fn from_stream(
load_options: &LoadOptions,
stream: &gio::InputStream,
@@ -84,6 +91,10 @@ impl Handle {
})
}
+ /// Queries whether a document has a certain element `#foo`.
+ ///
+ /// The `id` must be an URL fragment identifier, i.e. something
+ /// like `#element_id`.
pub fn has_sub(&self, id: &str) -> Result<bool, RenderingError> {
match self.lookup_node(id) {
Ok(_) => Ok(true),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]