struct FilteredVec<T> {
items: Vec<T>,
index_mappings: Vec<Vec<usize>>,
original_len: usize,
}Expand description
A helper structure for filtering elements from a vector through multiple passes while tracking their original indices, allowing results to be mapped back to the original positions.
Fields§
§items: Vec<T>§index_mappings: Vec<Vec<usize>>§original_len: usizeImplementations§
Source§impl<T: Clone> FilteredVec<T>
impl<T: Clone> FilteredVec<T>
Sourcefn new<F>(items: &[T], predicate: F) -> Self
fn new<F>(items: &[T], predicate: F) -> Self
Creates a new FilteredVec by filtering items based on the given predicate
Sourcefn map_results_to_original<R: Clone>(
&self,
results: Vec<R>,
default_value: R,
) -> Vec<R>
fn map_results_to_original<R: Clone>( &self, results: Vec<R>, default_value: R, ) -> Vec<R>
Maps results from the filtered items back to their original positions Returns a vector with the same length as the original input, filled with default_value and updated with results at their original positions
Sourcefn trace_to_original_index(&self, current_idx: usize) -> usize
fn trace_to_original_index(&self, current_idx: usize) -> usize
Traces a filtered index back to its original index through all filter passes
Sourcefn chain_filter_slice<U: Clone, F>(
&self,
items: &[U],
predicate: F,
) -> FilteredVec<U>
fn chain_filter_slice<U: Clone, F>( &self, items: &[U], predicate: F, ) -> FilteredVec<U>
Apply a filter to a new set of items while chaining the index mapping from self (parent) This is useful when you have filtered items and then get a transformed slice (e.g., from gather_filters_for_pushdown) that you need to filter again
Auto Trait Implementations§
impl<T> Freeze for FilteredVec<T>
impl<T> RefUnwindSafe for FilteredVec<T>where
T: RefUnwindSafe,
impl<T> Send for FilteredVec<T>where
T: Send,
impl<T> Sync for FilteredVec<T>where
T: Sync,
impl<T> Unpin for FilteredVec<T>where
T: Unpin,
impl<T> UnwindSafe for FilteredVec<T>where
T: UnwindSafe,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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