From 0125cb28b038d8c806647a51c4c43247c0c54d39 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Thu, 5 May 2022 12:27:08 +0100 Subject: [PATCH] Implement Deref on SQL Order type --- lib/src/dbs/iterator.rs | 4 ++-- lib/src/sql/order.rs | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/src/dbs/iterator.rs b/lib/src/dbs/iterator.rs index b3d0cb40..b5dd8fc3 100644 --- a/lib/src/dbs/iterator.rs +++ b/lib/src/dbs/iterator.rs @@ -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), }, }; // diff --git a/lib/src/sql/order.rs b/lib/src/sql/order.rs index 9306d10b..a8aa0ed5 100644 --- a/lib/src/sql/order.rs +++ b/lib/src/sql/order.rs @@ -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)?;