Implement Deref on SQL Order type

This commit is contained in:
Tobie Morgan Hitchcock 2022-05-05 12:27:08 +01:00
parent 89f731c903
commit 0125cb28b0
2 changed files with 9 additions and 2 deletions

View file

@ -295,8 +295,8 @@ impl Iterator {
a.partial_cmp(&b)
}
false => match order.direction {
true => a.compare(b, &order.order, order.collate, order.numeric),
false => b.compare(a, &order.order, order.collate, order.numeric),
true => a.compare(b, order, order.collate, order.numeric),
false => b.compare(a, order, order.collate, order.numeric),
},
};
//

View file

@ -48,6 +48,13 @@ pub struct Order {
pub direction: bool,
}
impl Deref for Order {
type Target = Idiom;
fn deref(&self) -> &Self::Target {
&self.order
}
}
impl fmt::Display for Order {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.order)?;