Looking back, my initial macro was a bit over-engineered, the concrete types should be an improvement to maintainability, since they're restricted to one `py_class!`.

This whole series looks good to me, thanks a lot.

On 9/8/19 12:05 PM, Yuya Nishihara wrote:
# HG changeset patch
# User Yuya Nishihara <y...@tcha.org>
# Date 1567916635 -32400
#      Sun Sep 08 13:23:55 2019 +0900
# Node ID 8174e0c96c14e5b5e2309a9de1a90b7c446b5aab
# Parent  1fa833aa2e43f6b3055d618755f10daeefacb0ae
rust-cpython: leverage py_shared_iterator::from_inner() where appropriate

diff --git a/rust/hg-cpython/src/dirstate/dirs_multiset.rs 
b/rust/hg-cpython/src/dirstate/dirs_multiset.rs
--- a/rust/hg-cpython/src/dirstate/dirs_multiset.rs
+++ b/rust/hg-cpython/src/dirstate/dirs_multiset.rs
@@ -90,10 +90,10 @@ py_class!(pub class Dirs |py| {
      }
      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(),
          )
      }
diff --git a/rust/hg-cpython/src/ref_sharing.rs b/rust/hg-cpython/src/ref_sharing.rs
--- a/rust/hg-cpython/src/ref_sharing.rs
+++ b/rust/hg-cpython/src/ref_sharing.rs
@@ -309,10 +309,10 @@ macro_rules! py_shared_ref {
  ///
  ///     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(),
  ///         )
  ///     }
  /// });
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to