diff rust/hg-cpython/src/dirstate/dirstate_map.rs @ 42888:67853749961b

rust-cpython: replace dyn Iterator<..> of mapping with concrete type See the previous commit for why. The docstring is moved accordingly.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 08 Sep 2019 12:23:18 +0900
parents 64e28b891796
children ea91a126c803
line wrap: on
line diff
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs	Sun Sep 08 12:07:19 2019 +0900
+++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs	Sun Sep 08 12:23:18 2019 +0900
@@ -25,7 +25,8 @@
 };
 use hg::{
     DirsMultiset, DirstateEntry, DirstateMap as RustDirstateMap,
-    DirstateParents, DirstateParseError, EntryState, PARENT_SIZE,
+    DirstateParents, DirstateParseError, EntryState, StateMapIter,
+    PARENT_SIZE,
 };
 
 // TODO
@@ -323,7 +324,7 @@
         DirstateMapKeysIterator::from_inner(
             py,
             Some(leak_handle),
-            Box::new(leaked_ref.iter()),
+            leaked_ref.iter(),
         )
     }
 
@@ -332,7 +333,7 @@
         DirstateMapItemsIterator::from_inner(
             py,
             Some(leak_handle),
-            Box::new(leaked_ref.iter()),
+            leaked_ref.iter(),
         )
     }
 
@@ -341,7 +342,7 @@
         DirstateMapKeysIterator::from_inner(
             py,
             Some(leak_handle),
-            Box::new(leaked_ref.iter()),
+            leaked_ref.iter(),
         )
     }
 
@@ -438,7 +439,7 @@
         CopyMapKeysIterator::from_inner(
             py,
             Some(leak_handle),
-            Box::new(leaked_ref.copy_map.iter()),
+            leaked_ref.copy_map.iter(),
         )
     }
 
@@ -447,7 +448,7 @@
         CopyMapItemsIterator::from_inner(
             py,
             Some(leak_handle),
-            Box::new(leaked_ref.copy_map.iter()),
+            leaked_ref.copy_map.iter(),
         )
     }
 
@@ -483,20 +484,18 @@
 
 py_shared_ref!(DirstateMap, RustDirstateMap, inner, DirstateMapLeakedRef,);
 
-py_shared_mapping_iterator!(
+py_shared_iterator_impl!(
     DirstateMapKeysIterator,
     DirstateMapLeakedRef,
-    Vec<u8>,
-    DirstateEntry,
+    StateMapIter<'static>,
     DirstateMap::translate_key,
     Option<PyBytes>
 );
 
-py_shared_mapping_iterator!(
+py_shared_iterator_impl!(
     DirstateMapItemsIterator,
     DirstateMapLeakedRef,
-    Vec<u8>,
-    DirstateEntry,
+    StateMapIter<'static>,
     DirstateMap::translate_key_value,
     Option<(PyBytes, PyObject)>
 );