From e2eb4fa5c22e9b3543ab51f801875e91346c2522 Mon Sep 17 00:00:00 2001 From: Shanin Roman <40040452+Erigara@users.noreply.github.com> Date: Fri, 3 Nov 2023 02:00:43 +0300 Subject: [PATCH] ?Sized bounds for range method (#98) --- src/bptree/impl.rs | 6 +++--- src/internals/bptree/cursor.rs | 2 +- src/internals/bptree/iter.rs | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/bptree/impl.rs b/src/bptree/impl.rs index 9168e06..0b499b7 100644 --- a/src/bptree/impl.rs +++ b/src/bptree/impl.rs @@ -195,7 +195,7 @@ impl<'a, K: Clone + Ord + Debug + Sync + Send + 'static, V: Clone + Sync + Send pub fn range<'b, R, T>(&'b self, range: R) -> RangeIter<'b, K, V> where K: Borrow, - T: Ord, + T: Ord + ?Sized, R: RangeBounds, { self.inner.as_ref().range(range) @@ -344,7 +344,7 @@ impl<'a, K: Clone + Ord + Debug + Sync + Send + 'static, V: Clone + Sync + Send pub fn range<'b, R, T>(&'b self, range: R) -> RangeIter<'b, K, V> where K: Borrow, - T: Ord, + T: Ord + ?Sized, R: RangeBounds, { self.inner.as_ref().range(range) @@ -435,7 +435,7 @@ impl<'a, K: Clone + Ord + Debug + Sync + Send + 'static, V: Clone + Sync + Send pub fn range<'b, R, T>(&'b self, range: R) -> RangeIter<'b, K, V> where K: Borrow, - T: Ord, + T: Ord + ?Sized, R: RangeBounds, { match self.inner { diff --git a/src/internals/bptree/cursor.rs b/src/internals/bptree/cursor.rs index e2b80e3..05393d9 100644 --- a/src/internals/bptree/cursor.rs +++ b/src/internals/bptree/cursor.rs @@ -253,7 +253,7 @@ pub(crate) trait CursorReadOps { fn range<'a, R, T>(&'a self, range: R) -> RangeIter<'a, K, V> where K: Borrow, - T: Ord, + T: Ord + ?Sized, R: RangeBounds, { RangeIter::new(self.get_root(), range, self.len()) diff --git a/src/internals/bptree/iter.rs b/src/internals/bptree/iter.rs index 2b6dc48..773e149 100644 --- a/src/internals/bptree/iter.rs +++ b/src/internals/bptree/iter.rs @@ -25,7 +25,7 @@ where { pub(crate) fn new(root: *mut Node, bound: Bound<&T>) -> Self where - T: Ord, + T: Ord + ?Sized, K: Borrow, { // We need to position the VecDeque here. @@ -165,7 +165,7 @@ where { pub(crate) fn new(root: *mut Node, bound: Bound<&T>) -> Self where - T: Ord, + T: Ord + ?Sized, K: Borrow, { // We need to position the VecDeque here. @@ -443,7 +443,7 @@ where { pub(crate) fn new(root: *mut Node, range: R, length: usize) -> Self where - T: Ord, + T: Ord + ?Sized, K: Borrow, R: RangeBounds, {