changeset 42886:7083ac37314f

rust-dirstate: provide CopyMapIter and StateMapIter types They will be used in the declaration of Python iterator types.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 08 Sep 2019 12:00:26 +0900
parents a03a29462c0a
children 706104dcb2c8
files rust/hg-core/src/dirstate.rs rust/hg-core/src/lib.rs
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate.rs	Sun Sep 08 11:55:29 2019 +0900
+++ b/rust/hg-core/src/dirstate.rs	Sun Sep 08 12:00:26 2019 +0900
@@ -6,6 +6,7 @@
 // GNU General Public License version 2 or any later version.
 
 use crate::DirstateParseError;
+use std::collections::hash_map;
 use std::collections::HashMap;
 use std::convert::TryFrom;
 
@@ -31,7 +32,9 @@
 }
 
 pub type StateMap = HashMap<Vec<u8>, DirstateEntry>;
+pub type StateMapIter<'a> = hash_map::Iter<'a, Vec<u8>, DirstateEntry>;
 pub type CopyMap = HashMap<Vec<u8>, Vec<u8>>;
+pub type CopyMapIter<'a> = hash_map::Iter<'a, Vec<u8>, Vec<u8>>;
 
 #[derive(Copy, Clone, Debug, Eq, PartialEq)]
 pub enum EntryState {
--- a/rust/hg-core/src/lib.rs	Sun Sep 08 11:55:29 2019 +0900
+++ b/rust/hg-core/src/lib.rs	Sun Sep 08 12:00:26 2019 +0900
@@ -12,7 +12,8 @@
     dirs_multiset::{DirsMultiset, DirsMultisetIter},
     dirstate_map::DirstateMap,
     parsers::{pack_dirstate, parse_dirstate, PARENT_SIZE},
-    CopyMap, DirstateEntry, DirstateParents, EntryState, StateMap,
+    CopyMap, CopyMapIter, DirstateEntry, DirstateParents, EntryState,
+    StateMap, StateMapIter,
 };
 mod filepatterns;
 pub mod utils;