pub struct BTree<S, C, G> { /* private fields */ }
Expand description
A B+Tree
Implementations§
source§impl<S, C, FE, G> BTree<S, C, G>where
S: Schema,
C: Collate<Value = S::Value>,
FE: AsType<Node<Vec<Vec<S::Value>>>> + Send + Sync,
G: DirDeref<Entry = FE>,
Node<Vec<Vec<S::Value>>>: FileLoad + Debug,
impl<S, C, FE, G> BTree<S, C, G>where S: Schema, C: Collate<Value = S::Value>, FE: AsType<Node<Vec<Vec<S::Value>>>> + Send + Sync, G: DirDeref<Entry = FE>, Node<Vec<Vec<S::Value>>>: FileLoad + Debug,
sourcepub async fn contains(&self, key: &[S::Value]) -> Result<bool, Error>
pub async fn contains(&self, key: &[S::Value]) -> Result<bool, Error>
Return true
if this B+Tree contains the given key
.
sourcepub async fn count<BV>(&self, range: &Range<BV>) -> Result<u64, Error>where
BV: Borrow<S::Value>,
pub async fn count<BV>(&self, range: &Range<BV>) -> Result<u64, Error>where BV: Borrow<S::Value>,
Count how many keys lie within the given range
of this B+Tree.
sourcepub async fn first<BV>(
&self,
range: Range<BV>
) -> Result<Option<Key<S::Value>>, Error>where
BV: Borrow<S::Value>,
pub async fn first<BV>( &self, range: Range<BV> ) -> Result<Option<Key<S::Value>>, Error>where BV: Borrow<S::Value>,
Return the first key in this B+Tree within the given range
, if any.
source§impl<S, C, FE, G> BTree<S, C, G>where
S: Schema,
C: Collate<Value = S::Value> + Clone + Send + Sync + 'static,
FE: AsType<Node<Vec<Vec<S::Value>>>> + Send + Sync + 'static,
G: DirDeref<Entry = FE> + Clone + Send + Sync + 'static,
Node<Vec<Vec<S::Value>>>: FileLoad + Debug,
impl<S, C, FE, G> BTree<S, C, G>where S: Schema, C: Collate<Value = S::Value> + Clone + Send + Sync + 'static, FE: AsType<Node<Vec<Vec<S::Value>>>> + Send + Sync + 'static, G: DirDeref<Entry = FE> + Clone + Send + Sync + 'static, Node<Vec<Vec<S::Value>>>: FileLoad + Debug,
sourcepub async fn keys<BV>(
self,
range: Range<BV>,
reverse: bool
) -> Result<Keys<S::Value>, Error>where
BV: Borrow<S::Value> + Clone + Send + Sync + 'static,
pub async fn keys<BV>( self, range: Range<BV>, reverse: bool ) -> Result<Keys<S::Value>, Error>where BV: Borrow<S::Value> + Clone + Send + Sync + 'static,
Construct a [Stream
] of all the keys in the given range
of this B+Tree.
sourcepub async fn groups<BV>(
self,
range: Range<BV>,
n: usize,
reverse: bool
) -> Result<Keys<S::Value>, Error>where
BV: Borrow<S::Value> + Clone + Send + Sync + 'static,
pub async fn groups<BV>( self, range: Range<BV>, n: usize, reverse: bool ) -> Result<Keys<S::Value>, Error>where BV: Borrow<S::Value> + Clone + Send + Sync + 'static,
Construct a [Stream
] of unique length-n
prefixes within the given range
.
pub async fn is_valid(self) -> Result<bool, Error>
source§impl<S, C, FE> BTree<S, C, DirWriteGuardOwned<FE>>
impl<S, C, FE> BTree<S, C, DirWriteGuardOwned<FE>>
sourcepub fn downgrade(self) -> BTreeReadGuard<S, C, FE>
pub fn downgrade(self) -> BTreeReadGuard<S, C, FE>
Downgrade this BTreeWriteGuard
into a BTreeReadGuard
.
source§impl<S, C, FE> BTree<S, C, DirWriteGuardOwned<FE>>where
S: Schema + Send + Sync,
C: Collate<Value = S::Value> + Send + Sync,
FE: AsType<Node<Vec<Vec<S::Value>>>> + Send + Sync,
Node<Vec<Vec<S::Value>>>: FileLoad,
impl<S, C, FE> BTree<S, C, DirWriteGuardOwned<FE>>where S: Schema + Send + Sync, C: Collate<Value = S::Value> + Send + Sync, FE: AsType<Node<Vec<Vec<S::Value>>>> + Send + Sync, Node<Vec<Vec<S::Value>>>: FileLoad,
sourcepub async fn delete<V>(&mut self, key: &[V]) -> Result<bool, Error>where
V: Borrow<S::Value> + Send + Sync,
pub async fn delete<V>(&mut self, key: &[V]) -> Result<bool, Error>where V: Borrow<S::Value> + Send + Sync,
Delete the given key
from this B+Tree.
source§impl<S, C, FE> BTree<S, C, DirWriteGuardOwned<FE>>where
S: Schema + Send + Sync,
C: Collate<Value = S::Value> + Clone + Send + Sync + 'static,
FE: AsType<Node<Vec<Vec<S::Value>>>> + Send + Sync + 'static,
Node<Vec<Vec<S::Value>>>: FileLoad,
impl<S, C, FE> BTree<S, C, DirWriteGuardOwned<FE>>where S: Schema + Send + Sync, C: Collate<Value = S::Value> + Clone + Send + Sync + 'static, FE: AsType<Node<Vec<Vec<S::Value>>>> + Send + Sync + 'static, Node<Vec<Vec<S::Value>>>: FileLoad,
Trait Implementations§
Auto Trait Implementations§
impl<S, C, G> RefUnwindSafe for BTree<S, C, G>where C: RefUnwindSafe, G: RefUnwindSafe, S: RefUnwindSafe,
impl<S, C, G> Send for BTree<S, C, G>where C: Send, G: Send, S: Send + Sync,
impl<S, C, G> Sync for BTree<S, C, G>where C: Sync, G: Sync, S: Send + Sync,
impl<S, C, G> Unpin for BTree<S, C, G>where C: Unpin, G: Unpin,
impl<S, C, G> UnwindSafe for BTree<S, C, G>where C: UnwindSafe, G: UnwindSafe, S: RefUnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<F> Match for F
impl<F> Match for F
source§fn matches<T>(&self) -> boolwhere
T: TryCastFrom<Self>,
fn matches<T>(&self) -> boolwhere T: TryCastFrom<Self>,
Returns
true
if self
can be cast into the target type T
.source§impl<F, T> TryCastFrom<F> for Twhere
T: CastFrom<F>,
impl<F, T> TryCastFrom<F> for Twhere T: CastFrom<F>,
source§fn can_cast_from(_: &F) -> bool
fn can_cast_from(_: &F) -> bool
Test if
value
can be cast into Self
.source§fn opt_cast_from(f: F) -> Option<T>
fn opt_cast_from(f: F) -> Option<T>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.source§impl<F, T> TryCastInto<T> for Fwhere
T: TryCastFrom<F>,
impl<F, T> TryCastInto<T> for Fwhere T: TryCastFrom<F>,
source§fn can_cast_into(&self) -> bool
fn can_cast_into(&self) -> bool
Test if
self
can be cast into T
.source§fn opt_cast_into(self) -> Option<T>
fn opt_cast_into(self) -> Option<T>
Returns
Some(T)
if self
can be cast into T
, otherwise None
.