parent
60609a44ba
commit
80f07dadc5
|
@ -260,7 +260,10 @@ impl Bank {
|
|||
.collect()
|
||||
}
|
||||
|
||||
pub fn process_entries(&self, entries: Vec<Entry>) -> Result<()> {
|
||||
pub fn process_entries<I>(&self, entries: I) -> Result<()>
|
||||
where
|
||||
I: IntoIterator<Item = Entry>,
|
||||
{
|
||||
for entry in entries {
|
||||
self.register_entry_id(&entry.id);
|
||||
for result in self.process_transactions(entry.transactions) {
|
||||
|
|
|
@ -114,17 +114,7 @@ fn main() {
|
|||
bank.register_entry_id(&entry1.id);
|
||||
|
||||
eprintln!("processing entries...");
|
||||
|
||||
for entry in entries {
|
||||
let results = bank.process_transactions(entry.transactions);
|
||||
for result in results {
|
||||
if let Err(e) = result {
|
||||
eprintln!("failed to process transaction {:?}", e);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
bank.register_entry_id(&entry.id);
|
||||
}
|
||||
bank.process_entries(entries).expect("process_entries");
|
||||
|
||||
eprintln!("creating networking stack...");
|
||||
|
||||
|
|
Loading…
Reference in New Issue