changeset 42891:5ccc08d02280

rust-cpython: leverage py_shared_iterator::from_inner() where appropriate
author Yuya Nishihara <yuya@tcha.org>
date Sun, 08 Sep 2019 13:23:55 +0900
parents 74d67c645278
children a65c4715fb5d
files rust/hg-cpython/src/dirstate/dirs_multiset.rs rust/hg-cpython/src/ref_sharing.rs
diffstat 2 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/rust/hg-cpython/src/dirstate/dirs_multiset.rs	Sun Sep 08 13:08:59 2019 +0900
+++ b/rust/hg-cpython/src/dirstate/dirs_multiset.rs	Sun Sep 08 13:23:55 2019 +0900
@@ -90,10 +90,10 @@
     }
     def __iter__(&self) -> PyResult<DirsMultisetKeysIterator> {
         let (leak_handle, leaked_ref) = unsafe { self.leak_immutable(py)? };
-        DirsMultisetKeysIterator::create_instance(
+        DirsMultisetKeysIterator::from_inner(
             py,
-            RefCell::new(Some(leak_handle)),
-            RefCell::new(leaked_ref.iter()),
+            leak_handle,
+            leaked_ref.iter(),
         )
     }
 
--- a/rust/hg-cpython/src/ref_sharing.rs	Sun Sep 08 13:08:59 2019 +0900
+++ b/rust/hg-cpython/src/ref_sharing.rs	Sun Sep 08 13:23:55 2019 +0900
@@ -309,10 +309,10 @@
 ///
 ///     def __iter__(&self) -> PyResult<MyTypeItemsIterator> {
 ///         let (leak_handle, leaked_ref) = unsafe { self.leak_immutable(py)? };
-///         MyTypeItemsIterator::create_instance(
+///         MyTypeItemsIterator::from_inner(
 ///             py,
-///             RefCell::new(Some(leak_handle)),
-///             RefCell::new(leaked_ref.iter()),
+///             leak_handle,
+///             leaked_ref.iter(),
 ///         )
 ///     }
 /// });