##// END OF EJS Templates
rust-cpython: replace dyn Iterator<..> of sequence with concrete type...
Yuya Nishihara -
r43157:706104dc default
parent child Browse files
Show More
@@ -18,7 +18,10 b' use cpython::{'
18
18
19 use crate::dirstate::extract_dirstate;
19 use crate::dirstate::extract_dirstate;
20 use crate::ref_sharing::{PySharedRefCell, PySharedState};
20 use crate::ref_sharing::{PySharedRefCell, PySharedState};
21 use hg::{DirsMultiset, DirstateMapError, DirstateParseError, EntryState};
21 use hg::{
22 DirsMultiset, DirsMultisetIter, DirstateMapError, DirstateParseError,
23 EntryState,
24 };
22
25
23 py_class!(pub class Dirs |py| {
26 py_class!(pub class Dirs |py| {
24 data inner: PySharedRefCell<DirsMultiset>;
27 data inner: PySharedRefCell<DirsMultiset>;
@@ -90,7 +93,7 b' py_class!(pub class Dirs |py| {'
90 DirsMultisetKeysIterator::create_instance(
93 DirsMultisetKeysIterator::create_instance(
91 py,
94 py,
92 RefCell::new(Some(leak_handle)),
95 RefCell::new(Some(leak_handle)),
93 RefCell::new(Box::new(leaked_ref.iter())),
96 RefCell::new(leaked_ref.iter()),
94 )
97 )
95 }
98 }
96
99
@@ -118,10 +121,10 b' impl Dirs {'
118 }
121 }
119 }
122 }
120
123
121 py_shared_sequence_iterator!(
124 py_shared_iterator_impl!(
122 DirsMultisetKeysIterator,
125 DirsMultisetKeysIterator,
123 DirsMultisetLeakedRef,
126 DirsMultisetLeakedRef,
124 Vec<u8>,
127 DirsMultisetIter<'static>,
125 Dirs::translate_key,
128 Dirs::translate_key,
126 Option<PyBytes>
129 Option<PyBytes>
127 );
130 );
@@ -417,23 +417,3 b' macro_rules! py_shared_mapping_iterator '
417 );
417 );
418 };
418 };
419 }
419 }
420
421 /// Works basically the same as `py_shared_mapping_iterator`, but with only a
422 /// key.
423 macro_rules! py_shared_sequence_iterator {
424 (
425 $name:ident,
426 $leaked:ident,
427 $key_type: ty,
428 $success_func: path,
429 $success_type: ty
430 ) => {
431 py_shared_iterator_impl!(
432 $name,
433 $leaked,
434 Box<dyn Iterator<Item = &'static $key_type> + Send>,
435 $success_func,
436 $success_type
437 );
438 };
439 }
General Comments 0
You need to be logged in to leave comments. Login now