events: Implement {From,Into}Iterator for ReceiptEventContent
This commit is contained in:
parent
53f9cf52ed
commit
54d27f1083
@ -5,7 +5,7 @@
|
|||||||
mod receipt_thread_serde;
|
mod receipt_thread_serde;
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
collections::BTreeMap,
|
collections::{btree_map, BTreeMap},
|
||||||
ops::{Deref, DerefMut},
|
ops::{Deref, DerefMut},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -54,6 +54,24 @@ impl DerefMut for ReceiptEventContent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl IntoIterator for ReceiptEventContent {
|
||||||
|
type Item = (OwnedEventId, Receipts);
|
||||||
|
type IntoIter = btree_map::IntoIter<OwnedEventId, Receipts>;
|
||||||
|
|
||||||
|
fn into_iter(self) -> Self::IntoIter {
|
||||||
|
self.0.into_iter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromIterator<(OwnedEventId, Receipts)> for ReceiptEventContent {
|
||||||
|
fn from_iter<T>(iter: T) -> Self
|
||||||
|
where
|
||||||
|
T: IntoIterator<Item = (OwnedEventId, Receipts)>,
|
||||||
|
{
|
||||||
|
Self(BTreeMap::from_iter(iter))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// A collection of receipts.
|
/// A collection of receipts.
|
||||||
pub type Receipts = BTreeMap<ReceiptType, UserReceipts>;
|
pub type Receipts = BTreeMap<ReceiptType, UserReceipts>;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user