[librsvg: 2/3] property_bag: remove ffi leftovers
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 2/3] property_bag: remove ffi leftovers
- Date: Tue, 18 Dec 2018 17:55:49 +0000 (UTC)
commit 74d5cdad95b11f83160780e7da4b6bea09adcc8c
Author: Paolo Borelli <pborelli gnome org>
Date: Tue Dec 18 12:09:36 2018 +0100
property_bag: remove ffi leftovers
rsvg_internals/src/property_bag.rs | 26 ++++----------------------
1 file changed, 4 insertions(+), 22 deletions(-)
---
diff --git a/rsvg_internals/src/property_bag.rs b/rsvg_internals/src/property_bag.rs
index e9f58881..f9646c17 100644
--- a/rsvg_internals/src/property_bag.rs
+++ b/rsvg_internals/src/property_bag.rs
@@ -11,9 +11,7 @@ pub struct PropertyBag<'a>(Vec<(Attribute, &'a CStr)>);
pub struct OwnedPropertyBag(Vec<(Attribute, CString)>);
-pub struct PropertyBagIter<'a>(PropertyBagCStrIter<'a>);
-
-pub struct PropertyBagCStrIter<'a>(slice::Iter<'a, (Attribute, &'a CStr)>);
+pub struct PropertyBagIter<'a>(slice::Iter<'a, (Attribute, &'a CStr)>);
trait Utf8CStrToStr {
fn to_str_utf8(&self) -> &str;
@@ -98,20 +96,12 @@ impl<'a> PropertyBag<'a> {
OwnedPropertyBag(array)
}
- pub fn ffi(&self) -> *const PropertyBag<'_> {
- self as *const PropertyBag<'_>
- }
-
pub fn len(&self) -> usize {
self.0.len()
}
pub fn iter(&self) -> PropertyBagIter<'_> {
- PropertyBagIter(self.cstr_iter())
- }
-
- pub fn cstr_iter(&self) -> PropertyBagCStrIter<'_> {
- PropertyBagCStrIter(self.0.iter())
+ PropertyBagIter(self.0.iter())
}
}
@@ -119,15 +109,7 @@ impl<'a> Iterator for PropertyBagIter<'a> {
type Item = (Attribute, &'a str);
fn next(&mut self) -> Option<Self::Item> {
- self.0.next().map(|(a, v)| (a, v.to_str_utf8()))
- }
-}
-
-impl<'a> Iterator for PropertyBagCStrIter<'a> {
- type Item = (Attribute, &'a CStr);
-
- fn next(&mut self) -> Option<Self::Item> {
- self.0.next().map(|&(a, v)| (a, v))
+ self.0.next().map(|&(a, v)| (a, v.to_str_utf8()))
}
}
@@ -175,7 +157,7 @@ mod tests {
assert!(v == "2");
had_ry = true;
}
- _ => unreachable!()
+ _ => unreachable!(),
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]