pub struct TournamentTree { /* private fields */ }Expand description
Tournament tree for efficient k-way merge
Uses a complete binary tree where each internal node contains the “winner” of comparing its two children.
Implementations§
Source§impl TournamentTree
impl TournamentTree
Sourcepub fn initialize(&mut self, sources: &[Box<dyn EntrySource>])
pub fn initialize(&mut self, sources: &[Box<dyn EntrySource>])
Initialize tree with current entries from sources
Sourcepub fn peek(&self) -> Option<&VersionedEntry>
pub fn peek(&self) -> Option<&VersionedEntry>
Get the current winner (minimum key)
Sourcepub fn winner_source(&self) -> Option<u32>
pub fn winner_source(&self) -> Option<u32>
Get the source index of the current winner
Sourcepub fn pop(
&mut self,
sources: &mut [Box<dyn EntrySource>],
) -> Option<VersionedEntry>
pub fn pop( &mut self, sources: &mut [Box<dyn EntrySource>], ) -> Option<VersionedEntry>
Advance the winning source and rebuild the tree
Auto Trait Implementations§
impl Freeze for TournamentTree
impl RefUnwindSafe for TournamentTree
impl Send for TournamentTree
impl Sync for TournamentTree
impl Unpin for TournamentTree
impl UnsafeUnpin for TournamentTree
impl UnwindSafe for TournamentTree
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more