Skip to content

Commit

Permalink
Improve readability
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiupuhalschi-rdx committed Aug 30, 2024
1 parent dc316ee commit ae56381
Showing 1 changed file with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,18 @@ impl TransactionManifest {
size: usize,
) -> Vec<AccountLockerClaimableResource> {
let mut current_batch_size = 0;
let mut claimable_resources_batch: Vec<AccountLockerClaimableResource> =
Vec::with_capacity(size);
for claimable in claimable_resources {
current_batch_size += match &claimable {
AccountLockerClaimableResource::Fungible { .. } => 1,
AccountLockerClaimableResource::NonFungible { ids, .. } => {
ids.len()
}
};
if current_batch_size < size {
claimable_resources_batch.push(claimable);
} else {
break;
}
}
claimable_resources_batch
claimable_resources
.into_iter()
.take_while(|claimable| {
current_batch_size += match claimable {
AccountLockerClaimableResource::Fungible { .. } => 1,
AccountLockerClaimableResource::NonFungible {
ids, ..
} => ids.len(),
};
current_batch_size < size
})
.collect()
}
}

Expand Down

0 comments on commit ae56381

Please sign in to comment.