facet distribution: implement Display for OrderBy

This commit is contained in:
Louis Dureuil 2024-09-12 17:41:01 +02:00
parent e44325683a
commit 23e14138bb
No known key found for this signature in database

View File

@ -1,4 +1,5 @@
use std::collections::{BTreeMap, HashMap, HashSet};
use std::fmt::Display;
use std::ops::ControlFlow;
use std::{fmt, mem};
@ -37,6 +38,15 @@ pub enum OrderBy {
Count,
}
impl Display for OrderBy {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
OrderBy::Lexicographic => f.write_str("alphabetically"),
OrderBy::Count => f.write_str("by count"),
}
}
}
pub struct FacetDistribution<'a> {
facets: Option<HashMap<String, OrderBy>>,
candidates: Option<RoaringBitmap>,