X6YJF46GPT3KOVC3MJPJRPWLW6PEECFXFJLMFHDFOADYJGX3EXUQC
let accounts = DashMap::<_, Vec<_>>::new();
directives
.into_par_iter()
.for_each_with(&accounts, |directives, directive| {
let index = (&directive).try_into().unwrap();
directives.entry(index).or_default().push(directive);
});
let accounts = directives
.into_iter()
.into_group_map_by(|directive| DirectiveIndex::try_from(directive).unwrap());
directives.par_sort_by_key(Directive::date);
directives.par_sort_by(|left, right| {
left.timestamp().zip(right.timestamp()).map_or_else(
|| left.date().cmp(&right.date()),
|(left, right)| left.cmp(&right),
)
});