diff rust/hg-cpython/src/dirstate/dirstate_map.rs @ 43177:5cb8867c9e2b

rust-cpython: move $leaked struct out of macro It wasn't easy to hack the $leaked struct since errors in macro would generate lots of compile errors. Let's make it a plain struct so we can easily extend it. PyLeakedRef keeps a more generic PyObject instead of the $name struct since it no longer has to call any specific methods implemented by the $name class. $leaked parameter in py_shared_iterator!() is kept for future change.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 08 Sep 2019 20:26:55 +0900
parents 070a38737334
children 1b2200bd06b6
line wrap: on
line diff
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs	Sun Sep 15 16:04:45 2019 +0900
+++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs	Sun Sep 08 20:26:55 2019 +0900
@@ -21,7 +21,7 @@
 use crate::{
     dirstate::copymap::{CopyMap, CopyMapItemsIterator, CopyMapKeysIterator},
     dirstate::{decapsule_make_dirstate_tuple, dirs_multiset::Dirs},
-    ref_sharing::PySharedRefCell,
+    ref_sharing::{PyLeakedRef, PySharedRefCell},
 };
 use hg::{
     utils::hg_path::{HgPath, HgPathBuf},
@@ -501,11 +501,11 @@
     }
 }
 
-py_shared_ref!(DirstateMap, RustDirstateMap, inner, DirstateMapLeakedRef,);
+py_shared_ref!(DirstateMap, RustDirstateMap, inner);
 
 py_shared_iterator!(
     DirstateMapKeysIterator,
-    DirstateMapLeakedRef,
+    PyLeakedRef,
     StateMapIter<'static>,
     DirstateMap::translate_key,
     Option<PyBytes>
@@ -513,7 +513,7 @@
 
 py_shared_iterator!(
     DirstateMapItemsIterator,
-    DirstateMapLeakedRef,
+    PyLeakedRef,
     StateMapIter<'static>,
     DirstateMap::translate_key_value,
     Option<(PyBytes, PyObject)>