Make sure that we register the field when setting criteria

This commit is contained in:
Kerollmops
2021-06-08 17:03:27 +02:00
parent 8e2c41e7f7
commit 82df524e09
2 changed files with 19 additions and 3 deletions

View File

@ -30,6 +30,16 @@ pub enum Criterion {
Desc(String),
}
impl Criterion {
/// Returns the field name parameter of this criterion.
pub fn field_name(&self) -> Option<&str> {
match self {
Criterion::Asc(name) | Criterion::Desc(name) => Some(name),
_otherwise => None,
}
}
}
impl FromStr for Criterion {
type Err = anyhow::Error;