Skip to content

Commit c48f9db

Browse files
committed
primitives - BalancesMap - impl IntoIterator
1 parent 1f07be1 commit c48f9db

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

primitives/src/balances_map.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::collections::BTreeMap;
22

33
use crate::{BigNum, ValidatorId};
4-
use std::collections::btree_map::{Entry, Iter, Values};
4+
use std::collections::btree_map::{Entry, Iter, IntoIter, Values};
55

66
use serde::{Deserialize, Serialize};
77
use std::iter::FromIterator;
@@ -50,6 +50,15 @@ impl FromIterator<(ValidatorId, BigNum)> for BalancesMap {
5050
}
5151
}
5252

53+
impl IntoIterator for BalancesMap {
54+
type Item = (ValidatorId, BigNum);
55+
type IntoIter = IntoIter<ValidatorId, BigNum>;
56+
57+
fn into_iter(self) -> Self::IntoIter {
58+
self.0.into_iter()
59+
}
60+
}
61+
5362
#[cfg(test)]
5463
mod test {
5564
use super::*;

0 commit comments

Comments
 (0)