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<Key<S::Value>>>> + Send + Sync,
G: Deref<Target = Dir<FE>>,
Node<Vec<Key<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<Key<S::Value>>>> + Send + Sync, G: Deref<Target = Dir<FE>>, Node<Vec<Key<S::Value>>>: FileLoad + Debug,
sourcepub async fn contains(&self, key: &Key<S::Value>) -> Result<bool, Error>
pub async fn contains(&self, key: &Key<S::Value>) -> Result<bool, Error>
Return true
if this B+Tree contains the given key
.
sourcepub async fn count(&self, range: &Range<S::Value>) -> Result<u64, Error>
pub async fn count(&self, range: &Range<S::Value>) -> Result<u64, Error>
Count how many keys lie within the given range
of this B+Tree.
sourcepub async fn first(
&self,
range: &Range<S::Value>
) -> Result<Option<Key<S::Value>>, Error>
pub async fn first( &self, range: &Range<S::Value> ) -> Result<Option<Key<S::Value>>, Error>
Return the first key in this B+Tree within the given range
, if any.
sourcepub async fn last(
&self,
range: &Range<S::Value>
) -> Result<Option<Key<S::Value>>, Error>
pub async fn last( &self, range: &Range<S::Value> ) -> Result<Option<Key<S::Value>>, Error>
Return the last key in this B+Tree with the given prefix
, if any.
sourcepub async fn is_empty(&self, range: &Range<S::Value>) -> Result<bool, Error>
pub async fn is_empty(&self, range: &Range<S::Value>) -> Result<bool, Error>
Return true
if the given range
of this B+Tree contains zero keys.
sourcepub fn nodes<'a>(
&'a self,
range: &'a Range<S::Value>
) -> impl Stream<Item = Result<FileReadGuardOwned<FE, [Key<S::Value>]>, Error>> + 'awhere
FE: 'a,
pub fn nodes<'a>( &'a self, range: &'a Range<S::Value> ) -> impl Stream<Item = Result<FileReadGuardOwned<FE, [Key<S::Value>]>, Error>> + 'awhere FE: 'a,
Borrow all the keys in the given range
of this B+Tree.
pub async fn is_valid(&self) -> Result<bool, Error>
source§impl<S, C, FE, G> BTree<S, C, G>where
S: Schema,
C: Collate<Value = S::Value> + Send + Sync + 'static,
FE: AsType<Node<Vec<Key<S::Value>>>> + Send + Sync + 'static,
G: Deref<Target = Dir<FE>> + Send + Sync + 'static,
Node<Vec<Key<S::Value>>>: FileLoad + Debug,
impl<S, C, FE, G> BTree<S, C, G>where S: Schema, C: Collate<Value = S::Value> + Send + Sync + 'static, FE: AsType<Node<Vec<Key<S::Value>>>> + Send + Sync + 'static, G: Deref<Target = Dir<FE>> + Send + Sync + 'static, Node<Vec<Key<S::Value>>>: FileLoad + Debug,
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<Key<S::Value>>>> + Send + Sync,
Node<Vec<Key<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<Key<S::Value>>>> + Send + Sync, Node<Vec<Key<S::Value>>>: FileLoad,
source§impl<S, C, FE> BTree<S, C, DirWriteGuardOwned<FE>>where
S: Schema + Send + Sync,
C: Collate<Value = S::Value> + Send + Sync + 'static,
FE: AsType<Node<Vec<Key<S::Value>>>> + Send + Sync + 'static,
Node<Vec<Key<S::Value>>>: FileLoad,
impl<S, C, FE> BTree<S, C, DirWriteGuardOwned<FE>>where S: Schema + Send + Sync, C: Collate<Value = S::Value> + Send + Sync + 'static, FE: AsType<Node<Vec<Key<S::Value>>>> + Send + Sync + 'static, Node<Vec<Key<S::Value>>>: FileLoad,
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 + Sync, G: Send, S: Send + Sync,
impl<S, C, G> Sync for BTree<S, C, G>where C: Send + Sync, G: Sync, S: Send + Sync,
impl<S, C, G> Unpin for BTree<S, C, G>where G: Unpin,
impl<S, C, G> UnwindSafe for BTree<S, C, G>where C: RefUnwindSafe, 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
.