[librsvg/rustification] property_bag.rs: Bindings for RsvgPropertyBag
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/rustification] property_bag.rs: Bindings for RsvgPropertyBag
- Date: Thu, 17 Nov 2016 21:36:41 +0000 (UTC)
commit 997c1a06f0a84bd3b26e2dfbf7250cfc2d3ac222
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Nov 17 11:53:52 2016 -0600
property_bag.rs: Bindings for RsvgPropertyBag
rust/src/lib.rs | 1 +
rust/src/property_bag.rs | 22 ++++++++++++++++++++++
2 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/rust/src/lib.rs b/rust/src/lib.rs
index 731d230..17db675 100644
--- a/rust/src/lib.rs
+++ b/rust/src/lib.rs
@@ -31,4 +31,5 @@ mod length;
mod marker;
mod path_builder;
mod path_parser;
+mod property_bag;
mod strtod;
diff --git a/rust/src/property_bag.rs b/rust/src/property_bag.rs
new file mode 100644
index 0000000..7a27383
--- /dev/null
+++ b/rust/src/property_bag.rs
@@ -0,0 +1,22 @@
+extern crate libc;
+extern crate glib;
+
+use self::glib::translate::*;
+
+pub enum RsvgPropertyBag {}
+
+extern "C" {
+ fn rsvg_property_bag_size (pbag: *const RsvgPropertyBag) -> libc::c_uint;
+ fn rsvg_property_bag_lookup (pbag: *const RsvgPropertyBag, key: *const libc::c_char) -> *const
libc::c_char;
+}
+
+pub fn get_size (pbag: *const RsvgPropertyBag) -> usize {
+ unsafe { rsvg_property_bag_size (pbag) as usize }
+}
+
+pub fn lookup (pbag: *const RsvgPropertyBag, key: &str) -> Option<String> {
+ unsafe {
+ let c_value = rsvg_property_bag_lookup (pbag, key.to_glib_none ().0);
+ from_glib_none (c_value)
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]