This commit is contained in:
Rob Ede 2022-02-28 13:43:22 +00:00 committed by ad hoc
parent 3b2e467ca6
commit 15150db957
No known key found for this signature in database
GPG key ID: 4F00A782990CC643
8 changed files with 13 additions and 16 deletions

View file

@ -4,13 +4,13 @@ pub mod v3;
/// Parses the v1 version of the Asc ranking rules `asc(price)`and returns the field name.
pub fn asc_ranking_rule(text: &str) -> Option<&str> {
text.split_once("asc(")
.and_then(|(_, tail)| tail.rsplit_once(")"))
.and_then(|(_, tail)| tail.rsplit_once(')'))
.map(|(field, _)| field)
}
/// Parses the v1 version of the Desc ranking rules `desc(price)`and returns the field name.
pub fn desc_ranking_rule(text: &str) -> Option<&str> {
text.split_once("desc(")
.and_then(|(_, tail)| tail.rsplit_once(")"))
.and_then(|(_, tail)| tail.rsplit_once(')'))
.map(|(field, _)| field)
}