pub struct EagerVec<V>(/* private fields */);Expand description
Wrapper for computing and storing derived values from source vectors.
EagerVec wraps any StoredVec and provides computation methods to derive and persist
calculated values. Results are stored on disk and automatically recomputed when:
- Source data versions change
- The vector’s computation logic version changes
§Key Features
- Incremental Updates: Only computes missing values, not the entire dataset
- Automatic Versioning: Detects stale data and recomputes automatically
- Batched Writes: Flushes periodically to prevent excessive memory usage
§Common Operations
- Transformations:
compute_transform(),compute_range() - Arithmetic:
compute_add(),compute_subtract(),compute_multiply(),compute_divide() - Moving statistics:
compute_sma(),compute_ema(),compute_sum(),compute_max(),compute_min() - Lookback calculations:
compute_change(),compute_percentage_change()
Implementations§
Source§impl<V> EagerVec<V>where
V: StoredVec,
impl<V> EagerVec<V>where
V: StoredVec,
pub fn compute_sum_of_others<O>( &mut self, max_from: V::I, others: &[&O], exit: &Exit, ) -> Result<()>
pub fn compute_min_of_others<O>( &mut self, max_from: V::I, others: &[&O], exit: &Exit, ) -> Result<()>
pub fn compute_max_of_others<O>( &mut self, max_from: V::I, others: &[&O], exit: &Exit, ) -> Result<()>
Sourcepub fn compute_weighted_average_of_others<W, OW, OV>(
&mut self,
max_from: V::I,
weights: &[&OW],
values: &[&OV],
exit: &Exit,
) -> Result<()>
pub fn compute_weighted_average_of_others<W, OW, OV>( &mut self, max_from: V::I, weights: &[&OW], values: &[&OV], exit: &Exit, ) -> Result<()>
Computes weighted average: sum(weight_i * value_i) / sum(weight_i)
Takes parallel slices of weight and value vecs from multiple sources. For each index, computes the weighted average across all sources. Returns zero if total weight is zero.
pub fn compute_sum_from_indexes<A, B>( &mut self, max_from: V::I, first_indexes: &impl ReadableVec<V::I, A>, indexes_count: &impl ReadableVec<V::I, B>, source: &(impl ReadableVec<A, V::T> + Sized), exit: &Exit, ) -> Result<()>
pub fn compute_filtered_sum_from_indexes<A, B>( &mut self, max_from: V::I, first_indexes: &impl ReadableVec<V::I, A>, indexes_count: &impl ReadableVec<V::I, B>, source: &(impl ReadableVec<A, V::T> + Sized), filter: impl FnMut(&V::T) -> bool, exit: &Exit, ) -> Result<()>
pub fn compute_count_from_indexes<A, B>( &mut self, max_from: V::I, first_indexes: &impl ReadableVec<V::I, A>, other_to_else: &impl ReadableVec<A, B>, exit: &Exit, ) -> Result<()>
pub fn compute_filtered_count_from_indexes<A, B>( &mut self, max_from: V::I, first_indexes: &impl ReadableVec<V::I, A>, other_to_else: &impl ReadableVec<A, B>, filter: impl FnMut(A) -> bool, exit: &Exit, ) -> Result<()>
Source§impl<V> EagerVec<V>where
V: StoredVec,
impl<V> EagerVec<V>where
V: StoredVec,
pub fn compute_add( &mut self, max_from: V::I, added: &impl ReadableVec<V::I, V::T>, adder: &impl ReadableVec<V::I, V::T>, exit: &Exit, ) -> Result<()>
pub fn compute_subtract(
&mut self,
max_from: V::I,
subtracted: &impl ReadableVec<V::I, V::T>,
subtracter: &impl ReadableVec<V::I, V::T>,
exit: &Exit,
) -> Result<()>where
V::T: CheckedSub,
pub fn compute_multiply<A, B>( &mut self, max_from: V::I, multiplied: &impl ReadableVec<V::I, A>, multiplier: &impl ReadableVec<V::I, B>, exit: &Exit, ) -> Result<()>
pub fn compute_divide<A, B>( &mut self, max_from: V::I, divided: &impl ReadableVec<V::I, A>, divider: &impl ReadableVec<V::I, B>, exit: &Exit, ) -> Result<()>
pub fn compute_percentage<A, B>( &mut self, max_from: V::I, divided: &impl ReadableVec<V::I, A>, divider: &impl ReadableVec<V::I, B>, exit: &Exit, ) -> Result<()>
pub fn compute_percentage_difference<A, B>( &mut self, max_from: V::I, divided: &impl ReadableVec<V::I, A>, divider: &impl ReadableVec<V::I, B>, exit: &Exit, ) -> Result<()>
Source§impl<V> EagerVec<V>where
V: StoredVec,
impl<V> EagerVec<V>where
V: StoredVec,
Sourcepub fn compute_cumulative<S>(
&mut self,
max_from: V::I,
source: &impl ReadableVec<V::I, S>,
exit: &Exit,
) -> Result<()>
pub fn compute_cumulative<S>( &mut self, max_from: V::I, source: &impl ReadableVec<V::I, S>, exit: &Exit, ) -> Result<()>
Compute cumulative sum from a source vec.
Each value in the result is the sum of all values from the source up to and including that index.
Sourcepub fn compute_cumulative_binary<S1, S2>(
&mut self,
max_from: V::I,
source1: &impl ReadableVec<V::I, S1>,
source2: &impl ReadableVec<V::I, S2>,
exit: &Exit,
) -> Result<()>
pub fn compute_cumulative_binary<S1, S2>( &mut self, max_from: V::I, source1: &impl ReadableVec<V::I, S1>, source2: &impl ReadableVec<V::I, S2>, exit: &Exit, ) -> Result<()>
Compute cumulative sum from adding two source vecs element-wise.
Each value in the result is the cumulative sum of source1[i] + source2[i]
for all indices up to and including i.
Sourcepub fn compute_cumulative_transformed_binary<S1, S2, F>(
&mut self,
max_from: V::I,
source1: &impl ReadableVec<V::I, S1>,
source2: &impl ReadableVec<V::I, S2>,
transform: F,
exit: &Exit,
) -> Result<()>
pub fn compute_cumulative_transformed_binary<S1, S2, F>( &mut self, max_from: V::I, source1: &impl ReadableVec<V::I, S1>, source2: &impl ReadableVec<V::I, S2>, transform: F, exit: &Exit, ) -> Result<()>
Compute cumulative sum from a custom binary transform of two source vecs.
Each value in the result is the cumulative sum of transform(source1[i], source2[i])
for all indices up to and including i.
Sourcepub fn compute_cumulative_count<S, P>(
&mut self,
max_from: V::I,
source: &impl ReadableVec<V::I, S>,
predicate: P,
exit: &Exit,
) -> Result<()>
pub fn compute_cumulative_count<S, P>( &mut self, max_from: V::I, source: &impl ReadableVec<V::I, S>, predicate: P, exit: &Exit, ) -> Result<()>
Compute cumulative count of values matching a predicate.
Each value in the result is the count of values from the source up to and including that index where the predicate returns true.
Sourcepub fn compute_rolling_count<S, P>(
&mut self,
max_from: V::I,
source: &impl ReadableVec<V::I, S>,
window_size: usize,
predicate: P,
exit: &Exit,
) -> Result<()>
pub fn compute_rolling_count<S, P>( &mut self, max_from: V::I, source: &impl ReadableVec<V::I, S>, window_size: usize, predicate: P, exit: &Exit, ) -> Result<()>
Compute rolling count of values matching a predicate within a window.
Sourcepub fn compute_cumulative_count_from<S, P>(
&mut self,
max_from: V::I,
source: &impl ReadableVec<V::I, S>,
from: V::I,
predicate: P,
exit: &Exit,
) -> Result<()>
pub fn compute_cumulative_count_from<S, P>( &mut self, max_from: V::I, source: &impl ReadableVec<V::I, S>, from: V::I, predicate: P, exit: &Exit, ) -> Result<()>
Compute cumulative count of values matching a predicate, starting from a specific index.
Values before from will be 0. Starting at from, counts values where predicate is true.
Source§impl<V> EagerVec<V>
impl<V> EagerVec<V>
pub fn compute_previous_value<A>( &mut self, max_from: V::I, source: &impl ReadableVec<V::I, A>, len: usize, exit: &Exit, ) -> Result<()>
Sourcepub fn compute_change<A>(
&mut self,
max_from: V::I,
source: &impl ReadableVec<V::I, A>,
len: usize,
exit: &Exit,
) -> Result<()>
pub fn compute_change<A>( &mut self, max_from: V::I, source: &impl ReadableVec<V::I, A>, len: usize, exit: &Exit, ) -> Result<()>
Compute N-period change. Converts source values to output type before subtraction to properly handle negative changes (e.g., unsigned source to signed output).
pub fn compute_ratio_change<A>( &mut self, max_from: V::I, source: &impl ReadableVec<V::I, A>, len: usize, exit: &Exit, ) -> Result<()>
pub fn compute_percentage_change<A>( &mut self, max_from: V::I, source: &impl ReadableVec<V::I, A>, len: usize, exit: &Exit, ) -> Result<()>
Sourcepub fn compute_rolling_from_window_starts<A, F>(
&mut self,
max_from: V::I,
window_starts: &impl ReadableVec<V::I, V::I>,
values: &impl ReadableVec<V::I, A>,
exit: &Exit,
compute: F,
) -> Result<()>
pub fn compute_rolling_from_window_starts<A, F>( &mut self, max_from: V::I, window_starts: &impl ReadableVec<V::I, V::I>, values: &impl ReadableVec<V::I, A>, exit: &Exit, compute: F, ) -> Result<()>
Shared helper for rolling computations using variable window starts.
Sourcepub fn compute_rolling_ratio_change<A>(
&mut self,
max_from: V::I,
window_starts: &impl ReadableVec<V::I, V::I>,
values: &impl ReadableVec<V::I, A>,
exit: &Exit,
) -> Result<()>
pub fn compute_rolling_ratio_change<A>( &mut self, max_from: V::I, window_starts: &impl ReadableVec<V::I, V::I>, values: &impl ReadableVec<V::I, A>, exit: &Exit, ) -> Result<()>
Compute ratio change using variable window starts (lookback vec).
For each index i, computes values[i] / values[window_starts[i]] - 1.
Sourcepub fn compute_rolling_percentage_change<A>(
&mut self,
max_from: V::I,
window_starts: &impl ReadableVec<V::I, V::I>,
values: &impl ReadableVec<V::I, A>,
exit: &Exit,
) -> Result<()>
pub fn compute_rolling_percentage_change<A>( &mut self, max_from: V::I, window_starts: &impl ReadableVec<V::I, V::I>, values: &impl ReadableVec<V::I, A>, exit: &Exit, ) -> Result<()>
Compute percentage change using variable window starts (lookback vec).
For each index i, computes (values[i] / values[window_starts[i]] - 1) * 100.
Sourcepub fn compute_rolling_change<A>(
&mut self,
max_from: V::I,
window_starts: &impl ReadableVec<V::I, V::I>,
values: &impl ReadableVec<V::I, A>,
exit: &Exit,
) -> Result<()>
pub fn compute_rolling_change<A>( &mut self, max_from: V::I, window_starts: &impl ReadableVec<V::I, V::I>, values: &impl ReadableVec<V::I, A>, exit: &Exit, ) -> Result<()>
Compute change using variable window starts (lookback vec).
For each index i, computes values[i] - values[window_starts[i]].
pub fn compute_cagr<A>( &mut self, max_from: V::I, percentage_returns: &impl ReadableVec<V::I, A>, days: usize, exit: &Exit, ) -> Result<()>
Sourcepub fn compute_lookback<A>(
&mut self,
max_from: V::I,
window_starts: &impl ReadableVec<V::I, V::I>,
source: &impl ReadableVec<V::I, A>,
exit: &Exit,
) -> Result<()>
pub fn compute_lookback<A>( &mut self, max_from: V::I, window_starts: &impl ReadableVec<V::I, V::I>, source: &impl ReadableVec<V::I, A>, exit: &Exit, ) -> Result<()>
For each index i, output[i] = source[window_starts[i]].
Efficiently caches lookups since window_starts are monotonically non-decreasing.
Source§impl<V> EagerVec<V>where
V: StoredVec,
impl<V> EagerVec<V>where
V: StoredVec,
pub fn compute_max<A>( &mut self, max_from: V::I, source: &impl ReadableVec<V::I, A>, window: usize, exit: &Exit, ) -> Result<()>
pub fn compute_min<A>( &mut self, max_from: V::I, source: &impl ReadableVec<V::I, A>, window: usize, exit: &Exit, ) -> Result<()>
pub fn compute_sum<A>( &mut self, max_from: V::I, source: &impl ReadableVec<V::I, A>, window: usize, exit: &Exit, ) -> Result<()>
Sourcepub fn compute_rolling_sum<A>(
&mut self,
max_from: V::I,
window_starts: &impl ReadableVec<V::I, V::I>,
values: &impl ReadableVec<V::I, A>,
exit: &Exit,
) -> Result<()>
pub fn compute_rolling_sum<A>( &mut self, max_from: V::I, window_starts: &impl ReadableVec<V::I, V::I>, values: &impl ReadableVec<V::I, A>, exit: &Exit, ) -> Result<()>
Compute rolling sum with variable window starts.
For each index i, computes sum of values from window_starts[i] to i (inclusive).
Sourcepub fn compute_rolling_average<A>(
&mut self,
max_from: V::I,
window_starts: &impl ReadableVec<V::I, V::I>,
values: &impl ReadableVec<V::I, A>,
exit: &Exit,
) -> Result<()>
pub fn compute_rolling_average<A>( &mut self, max_from: V::I, window_starts: &impl ReadableVec<V::I, V::I>, values: &impl ReadableVec<V::I, A>, exit: &Exit, ) -> Result<()>
Compute rolling average with variable window starts.
For each index i, computes mean of values from window_starts[i] to i (inclusive).
Sourcepub fn compute_rolling_sd<A, B>(
&mut self,
max_from: V::I,
window_starts: &impl ReadableVec<V::I, V::I>,
values: &impl ReadableVec<V::I, A>,
mean: &impl ReadableVec<V::I, B>,
exit: &Exit,
) -> Result<()>
pub fn compute_rolling_sd<A, B>( &mut self, max_from: V::I, window_starts: &impl ReadableVec<V::I, V::I>, values: &impl ReadableVec<V::I, A>, mean: &impl ReadableVec<V::I, B>, exit: &Exit, ) -> Result<()>
Compute rolling standard deviation with variable window starts.
For each index i, computes SD of values from window_starts[i] to i (inclusive),
using the provided rolling mean.
SD = sqrt(E[X²] - E[X]²) where E[X²] is the rolling mean of squares
and E[X] is the rolling mean from the mean parameter.
Sourcepub fn compute_expanding_sd<A, B>(
&mut self,
max_from: V::I,
values: &impl ReadableVec<V::I, A>,
mean: &impl ReadableVec<V::I, B>,
exit: &Exit,
) -> Result<()>
pub fn compute_expanding_sd<A, B>( &mut self, max_from: V::I, values: &impl ReadableVec<V::I, A>, mean: &impl ReadableVec<V::I, B>, exit: &Exit, ) -> Result<()>
Compute expanding (all-time) standard deviation.
For each index i, computes SD of all values from 0 to i (inclusive).
SD = sqrt(E[X²] - E[X]²).
Sourcepub fn compute_rolling_ema<A>(
&mut self,
max_from: V::I,
window_starts: &impl ReadableVec<V::I, V::I>,
values: &impl ReadableVec<V::I, A>,
exit: &Exit,
) -> Result<()>
pub fn compute_rolling_ema<A>( &mut self, max_from: V::I, window_starts: &impl ReadableVec<V::I, V::I>, values: &impl ReadableVec<V::I, A>, exit: &Exit, ) -> Result<()>
Compute rolling EMA with variable window starts.
For each index i, computes an exponential moving average with
α = 2/(span+1) where span = i - window_starts[i] + 1.
Sourcepub fn compute_rolling_rma<A>(
&mut self,
max_from: V::I,
window_starts: &impl ReadableVec<V::I, V::I>,
values: &impl ReadableVec<V::I, A>,
exit: &Exit,
) -> Result<()>
pub fn compute_rolling_rma<A>( &mut self, max_from: V::I, window_starts: &impl ReadableVec<V::I, V::I>, values: &impl ReadableVec<V::I, A>, exit: &Exit, ) -> Result<()>
Compute rolling RMA (Wilder’s smoothing) with variable window starts.
α = 1/span where span = i - window_starts[i] + 1.
Sourcepub fn compute_rolling_max_from_starts<A>(
&mut self,
max_from: V::I,
window_starts: &impl ReadableVec<V::I, V::I>,
source: &impl ReadableVec<V::I, A>,
exit: &Exit,
) -> Result<()>
pub fn compute_rolling_max_from_starts<A>( &mut self, max_from: V::I, window_starts: &impl ReadableVec<V::I, V::I>, source: &impl ReadableVec<V::I, A>, exit: &Exit, ) -> Result<()>
Compute rolling maximum with variable window starts (deque-based).
Sourcepub fn compute_rolling_min_from_starts<A>(
&mut self,
max_from: V::I,
window_starts: &impl ReadableVec<V::I, V::I>,
source: &impl ReadableVec<V::I, A>,
exit: &Exit,
) -> Result<()>
pub fn compute_rolling_min_from_starts<A>( &mut self, max_from: V::I, window_starts: &impl ReadableVec<V::I, V::I>, source: &impl ReadableVec<V::I, A>, exit: &Exit, ) -> Result<()>
Compute rolling minimum with variable window starts (deque-based).
Sourcepub fn compute_rolling_ratio<A, B>(
&mut self,
max_from: V::I,
window_starts: &impl ReadableVec<V::I, V::I>,
numerator: &impl ReadableVec<V::I, A>,
denominator: &impl ReadableVec<V::I, B>,
exit: &Exit,
) -> Result<()>
pub fn compute_rolling_ratio<A, B>( &mut self, max_from: V::I, window_starts: &impl ReadableVec<V::I, V::I>, numerator: &impl ReadableVec<V::I, A>, denominator: &impl ReadableVec<V::I, B>, exit: &Exit, ) -> Result<()>
Compute rolling ratio with variable window starts.
For each index i, computes sum(numerator[window_starts[i]..=i]) / denominator[i].
pub fn compute_sma<A>( &mut self, max_from: V::I, source: &impl ReadableVec<V::I, A>, sma: usize, exit: &Exit, ) -> Result<()>
pub fn compute_sma_<A>( &mut self, max_from: V::I, source: &impl ReadableVec<V::I, A>, window: usize, exit: &Exit, min_i: Option<V::I>, ) -> Result<()>
pub fn compute_rolling_median<A>( &mut self, max_from: V::I, source: &impl ReadableVec<V::I, A>, window: usize, exit: &Exit, ) -> Result<()>
pub fn compute_ema<A>( &mut self, max_from: V::I, source: &impl ReadableVec<V::I, A>, ema: usize, exit: &Exit, ) -> Result<()>
pub fn compute_ema_<A>( &mut self, max_from: V::I, source: &impl ReadableVec<V::I, A>, ema: usize, exit: &Exit, min_i: Option<V::I>, ) -> Result<()>
Sourcepub fn compute_rma<A>(
&mut self,
max_from: V::I,
source: &impl ReadableVec<V::I, A>,
period: usize,
exit: &Exit,
) -> Result<()>
pub fn compute_rma<A>( &mut self, max_from: V::I, source: &impl ReadableVec<V::I, A>, period: usize, exit: &Exit, ) -> Result<()>
Compute Wilder’s Running Moving Average (RMA). Uses alpha = 1/period instead of EMA’s 2/(period+1). This is the standard smoothing method for RSI.
Sourcepub fn compute_all_time_high<A>(
&mut self,
max_from: V::I,
source: &impl ReadableVec<V::I, A>,
exit: &Exit,
) -> Result<()>
pub fn compute_all_time_high<A>( &mut self, max_from: V::I, source: &impl ReadableVec<V::I, A>, exit: &Exit, ) -> Result<()>
Computes the all time high of a source.
This version is more optimized than compute_max with a window set to usize::MAX.
Sourcepub fn compute_all_time_low<A>(
&mut self,
max_from: V::I,
source: &impl ReadableVec<V::I, A>,
exit: &Exit,
) -> Result<()>
pub fn compute_all_time_low<A>( &mut self, max_from: V::I, source: &impl ReadableVec<V::I, A>, exit: &Exit, ) -> Result<()>
Computes the all time low of a source.
This version is more optimized than compute_min with a window set to usize::MAX.
Sourcepub fn compute_all_time_low_<A>(
&mut self,
max_from: V::I,
source: &impl ReadableVec<V::I, A>,
exit: &Exit,
exclude_default: bool,
) -> Result<()>
pub fn compute_all_time_low_<A>( &mut self, max_from: V::I, source: &impl ReadableVec<V::I, A>, exit: &Exit, exclude_default: bool, ) -> Result<()>
Computes the all time low of a source.
This version is more optimized than compute_min with a window set to usize::MAX.
Sourcepub fn compute_all_time_high_from<A>(
&mut self,
max_from: V::I,
source: &impl ReadableVec<V::I, A>,
from: V::I,
exit: &Exit,
) -> Result<()>
pub fn compute_all_time_high_from<A>( &mut self, max_from: V::I, source: &impl ReadableVec<V::I, A>, from: V::I, exit: &Exit, ) -> Result<()>
Computes the all time high starting from a specific index.
Values before from will be the default value (typically 0).
Sourcepub fn compute_all_time_low_from<A>(
&mut self,
max_from: V::I,
source: &impl ReadableVec<V::I, A>,
from: V::I,
exit: &Exit,
) -> Result<()>
pub fn compute_all_time_low_from<A>( &mut self, max_from: V::I, source: &impl ReadableVec<V::I, A>, from: V::I, exit: &Exit, ) -> Result<()>
Computes the all time low starting from a specific index.
Values before from will be the default value (typically 0).
pub fn compute_zscore<A, B, C>( &mut self, max_from: V::I, source: &impl ReadableVec<V::I, A>, sma: &impl ReadableVec<V::I, B>, sd: &impl ReadableVec<V::I, C>, exit: &Exit, ) -> Result<()>
Source§impl<V> EagerVec<V>where
V: StoredVec,
impl<V> EagerVec<V>where
V: StoredVec,
pub fn compute_to<F>( &mut self, max_from: V::I, to: usize, version: Version, t: F, exit: &Exit, ) -> Result<()>
pub fn compute_range<A, F>( &mut self, max_from: V::I, other: &impl ReadableVec<V::I, A>, t: F, exit: &Exit, ) -> Result<()>
pub fn compute_from_index<A>( &mut self, max_from: V::I, other: &impl ReadableVec<V::I, A>, exit: &Exit, ) -> Result<()>
pub fn compute_transform<A, F>( &mut self, max_from: V::I, source: &impl ReadableVec<V::I, A>, t: F, exit: &Exit, ) -> Result<()>
pub fn compute_transform2<A, B, F>( &mut self, max_from: V::I, other1: &impl ReadableVec<V::I, A>, other2: &impl ReadableVec<V::I, B>, t: F, exit: &Exit, ) -> Result<()>
pub fn compute_binary<A, B, F>( &mut self, max_from: V::I, source1: &impl ReadableVec<V::I, A>, source2: &impl ReadableVec<V::I, B>, exit: &Exit, ) -> Result<()>
pub fn compute_transform3<A, B, C, F>( &mut self, max_from: V::I, other1: &impl ReadableVec<V::I, A>, other2: &impl ReadableVec<V::I, B>, other3: &impl ReadableVec<V::I, C>, t: F, exit: &Exit, ) -> Result<()>
pub fn compute_transform4<A, B, C, D, F>( &mut self, max_from: V::I, other1: &impl ReadableVec<V::I, A>, other2: &impl ReadableVec<V::I, B>, other3: &impl ReadableVec<V::I, C>, other4: &impl ReadableVec<V::I, D>, t: F, exit: &Exit, ) -> Result<()>
Sourcepub fn compute_indirect_sequential<A>(
&mut self,
max_from: V::I,
source1: &impl ReadableVec<V::I, A>,
source2: &impl ReadableVec<A, V::T>,
exit: &Exit,
) -> Result<()>
pub fn compute_indirect_sequential<A>( &mut self, max_from: V::I, source1: &impl ReadableVec<V::I, A>, source2: &impl ReadableVec<A, V::T>, exit: &Exit, ) -> Result<()>
Compute values through an indirection: for each index i, produces
source2[source1[i]]. Keys from source1 must be monotonically increasing
so that source2 access is sequential (cursor-friendly).
pub fn compute_first_per_index( &mut self, max_from: V::T, other: &impl ReadableVec<V::T, V::I>, exit: &Exit, ) -> Result<()>
Source§impl<V> EagerVec<V>where
V: StoredVec,
impl<V> EagerVec<V>where
V: StoredVec,
Sourcepub fn batch_end(&self, max_end: usize) -> usize
pub fn batch_end(&self, max_end: usize) -> usize
Max end index for one batch, capped at max_end.
Ensures pushed_len * SIZE_OF_T >= MAX_CACHE_SIZE so batch_limit_reached() fires.
Sourcepub fn repeat_until_complete<F>(&mut self, exit: &Exit, f: F) -> Result<()>
pub fn repeat_until_complete<F>(&mut self, exit: &Exit, f: F) -> Result<()>
Helper that repeatedly calls a compute function until it completes. Writes between iterations when batch limit is hit.
Trait Implementations§
Source§impl<V> AnyStoredVec for EagerVec<V>where
V: StoredVec,
impl<V> AnyStoredVec for EagerVec<V>where
V: StoredVec,
fn db_path(&self) -> PathBuf
fn region(&self) -> &Region
fn header(&self) -> &Header
fn mut_header(&mut self) -> &mut Header
Source§fn saved_stamped_changes(&self) -> u16
fn saved_stamped_changes(&self) -> u16
Source§fn stored_len(&self) -> usize
fn stored_len(&self) -> usize
Source§fn real_stored_len(&self) -> usize
fn real_stored_len(&self) -> usize
fn serialize_changes(&self) -> Result<Vec<u8>>
Source§fn any_stamped_write_with_changes(&mut self, stamp: Stamp) -> Result<()>
fn any_stamped_write_with_changes(&mut self, stamp: Stamp) -> Result<()>
any_ to avoid conflict with WritableVec::stamped_write_with_changes.Source§fn any_truncate_if_needed_at(&mut self, index: usize) -> Result<()>
fn any_truncate_if_needed_at(&mut self, index: usize) -> Result<()>
any_ to avoid conflict with WritableVec::truncate_if_needed_at.fn flush(&mut self) -> Result<()>
fn update_stamp(&mut self, stamp: Stamp)
fn stamp(&self) -> Stamp
fn stamped_write(&mut self, stamp: Stamp) -> Result<()>
Source§impl<V> AnyVec for EagerVec<V>where
V: StoredVec,
impl<V> AnyVec for EagerVec<V>where
V: StoredVec,
fn version(&self) -> Version
fn name(&self) -> &str
fn len(&self) -> usize
Source§fn index_type_to_string(&self) -> &'static str
fn index_type_to_string(&self) -> &'static str
Source§fn value_type_to_size_of(&self) -> usize
fn value_type_to_size_of(&self) -> usize
Source§fn value_type_to_string(&self) -> &'static str
fn value_type_to_string(&self) -> &'static str
Source§fn region_names(&self) -> Vec<String>
fn region_names(&self) -> Vec<String>
fn is_empty(&self) -> bool
Source§fn region_name(&self) -> String
fn region_name(&self) -> String
Source§fn etag(&self, stamp: Stamp, to: Option<i64>) -> String
fn etag(&self, stamp: Stamp, to: Option<i64>) -> String
Source§fn i64_to_usize(&self, i: i64) -> usize
fn i64_to_usize(&self, i: i64) -> usize
Source§impl<V: ImportableVec> ImportableVec for EagerVec<V>
impl<V: ImportableVec> ImportableVec for EagerVec<V>
Source§fn import(db: &Database, name: &str, version: Version) -> Result<Self>
fn import(db: &Database, name: &str, version: Version) -> Result<Self>
Source§fn import_with(options: ImportOptions<'_>) -> Result<Self>
fn import_with(options: ImportOptions<'_>) -> Result<Self>
Source§fn forced_import(db: &Database, name: &str, version: Version) -> Result<Self>
fn forced_import(db: &Database, name: &str, version: Version) -> Result<Self>
Source§fn forced_import_with(options: ImportOptions<'_>) -> Result<Self>
fn forced_import_with(options: ImportOptions<'_>) -> Result<Self>
Source§impl<V> ReadableCloneableVec<<V as TypedVec>::I, <V as TypedVec>::T> for EagerVec<V>where
V: StoredVec,
impl<V> ReadableCloneableVec<<V as TypedVec>::I, <V as TypedVec>::T> for EagerVec<V>where
V: StoredVec,
fn read_only_boxed_clone(&self) -> ReadableBoxedVec<V::I, V::T>
Source§impl<V> ReadableVec<<V as TypedVec>::I, <V as TypedVec>::T> for EagerVec<V>where
V: StoredVec,
impl<V> ReadableVec<<V as TypedVec>::I, <V as TypedVec>::T> for EagerVec<V>where
V: StoredVec,
Source§fn fold_range_at<B, F: FnMut(B, V::T) -> B>(
&self,
from: usize,
to: usize,
init: B,
f: F,
) -> Bwhere
Self: Sized,
fn fold_range_at<B, F: FnMut(B, V::T) -> B>(
&self,
from: usize,
to: usize,
init: B,
f: F,
) -> Bwhere
Self: Sized,
[from, to) by raw index with an accumulator. Read moreSource§fn try_fold_range_at<B, E, F: FnMut(B, V::T) -> Result<B, E>>(
&self,
from: usize,
to: usize,
init: B,
f: F,
) -> Result<B, E>where
Self: Sized,
fn try_fold_range_at<B, E, F: FnMut(B, V::T) -> Result<B, E>>(
&self,
from: usize,
to: usize,
init: B,
f: F,
) -> Result<B, E>where
Self: Sized,
[from, to) by raw index with early exit on error. Read moreSource§fn read_into(&self, from: I, to: I, buf: &mut Vec<T>)
fn read_into(&self, from: I, to: I, buf: &mut Vec<T>)
[from, to) to buf using typed indices.Source§fn cursor(&self) -> Cursor<'_, I, T, Self>where
Self: Sized,
fn cursor(&self) -> Cursor<'_, I, T, Self>where
Self: Sized,
Cursor that reuses an internal buffer across
chunked read_into_at calls. One allocation for the lifetime of the cursor.Source§fn for_each_range_dyn(&self, from: I, to: I, f: &mut dyn FnMut(T))
fn for_each_range_dyn(&self, from: I, to: I, f: &mut dyn FnMut(T))
[from, to) by typed index, calling f for each value (object-safe).Source§fn fold_range<B, F: FnMut(B, T) -> B>(&self, from: I, to: I, init: B, f: F) -> Bwhere
Self: Sized,
fn fold_range<B, F: FnMut(B, T) -> B>(&self, from: I, to: I, init: B, f: F) -> Bwhere
Self: Sized,
[from, to) by typed index with an accumulator.Source§fn try_fold_range<B, E, F: FnMut(B, T) -> Result<B, E>>(
&self,
from: I,
to: I,
init: B,
f: F,
) -> Result<B, E>where
Self: Sized,
fn try_fold_range<B, E, F: FnMut(B, T) -> Result<B, E>>(
&self,
from: I,
to: I,
init: B,
f: F,
) -> Result<B, E>where
Self: Sized,
[from, to) by typed index with early exit on error.Source§fn for_each_range<F: FnMut(T)>(&self, from: I, to: I, f: F)where
Self: Sized,
fn for_each_range<F: FnMut(T)>(&self, from: I, to: I, f: F)where
Self: Sized,
f for each value in [from, to) by typed index. Requires Sized.Source§fn collect_range(&self, from: I, to: I) -> Vec<T>where
Self: Sized,
fn collect_range(&self, from: I, to: I) -> Vec<T>where
Self: Sized,
[from, to) by typed index into a Vec<T>.Source§fn collect_one(&self, index: I) -> Option<T>
fn collect_one(&self, index: I) -> Option<T>
index, or None if out of bounds.Source§fn min(&self, from: I, to: I) -> Option<T>where
Self: Sized,
T: PartialOrd,
fn min(&self, from: I, to: I) -> Option<T>where
Self: Sized,
T: PartialOrd,
[from, to) by typed index, or None if empty.Source§fn max(&self, from: I, to: I) -> Option<T>where
Self: Sized,
T: PartialOrd,
fn max(&self, from: I, to: I) -> Option<T>where
Self: Sized,
T: PartialOrd,
[from, to) by typed index, or None if empty.Source§fn sum(&self, from: I, to: I) -> Option<T>
fn sum(&self, from: I, to: I) -> Option<T>
[from, to) by typed index, or None if empty.Source§fn for_each_range_at<F: FnMut(T)>(&self, from: usize, to: usize, f: F)where
Self: Sized,
fn for_each_range_at<F: FnMut(T)>(&self, from: usize, to: usize, f: F)where
Self: Sized,
f for each value in [from, to) by raw index. Requires Sized (static dispatch).Source§fn try_for_each_range_at<E, F: FnMut(T) -> Result<(), E>>(
&self,
from: usize,
to: usize,
f: F,
) -> Result<(), E>where
Self: Sized,
fn try_for_each_range_at<E, F: FnMut(T) -> Result<(), E>>(
&self,
from: usize,
to: usize,
f: F,
) -> Result<(), E>where
Self: Sized,
[from, to) by raw index with early exit on error.Source§fn for_each<F: FnMut(T)>(&self, f: F)where
Self: Sized,
fn for_each<F: FnMut(T)>(&self, f: F)where
Self: Sized,
f for every value in the vector.Source§fn fold<B, F: FnMut(B, T) -> B>(&self, init: B, f: F) -> Bwhere
Self: Sized,
fn fold<B, F: FnMut(B, T) -> B>(&self, init: B, f: F) -> Bwhere
Self: Sized,
Source§fn collect_range_at(&self, from: usize, to: usize) -> Vec<T>where
Self: Sized,
fn collect_range_at(&self, from: usize, to: usize) -> Vec<T>where
Self: Sized,
[from, to) by raw index into a Vec<T>.Source§fn collect_range_into_at(&self, from: usize, to: usize, buf: &mut Vec<T>)
fn collect_range_into_at(&self, from: usize, to: usize, buf: &mut Vec<T>)
buf then fills it with values in [from, to). Reuses the buffer allocation.Source§fn collect_range_dyn(&self, from: usize, to: usize) -> Vec<T>
fn collect_range_dyn(&self, from: usize, to: usize) -> Vec<T>
[from, to) into a Vec<T> (object-safe).Source§fn collect_first(&self) -> Option<T>
fn collect_first(&self) -> Option<T>
None if empty.Source§fn collect_last(&self) -> Option<T>
fn collect_last(&self) -> Option<T>
None if empty.Source§fn collect_signed_range(&self, from: Option<i64>, to: Option<i64>) -> Vec<T>where
Self: Sized,
fn collect_signed_range(&self, from: Option<i64>, to: Option<i64>) -> Vec<T>where
Self: Sized,
-1 is the last element, -2 is second-to-last, etc.Source§fn collect_signed_range_dyn(&self, from: Option<i64>, to: Option<i64>) -> Vec<T>
fn collect_signed_range_dyn(&self, from: Option<i64>, to: Option<i64>) -> Vec<T>
Source§fn collect_dyn(&self) -> Vec<T>
fn collect_dyn(&self) -> Vec<T>
Vec<T> (object-safe).Source§fn read_sorted_into_at(&self, indices: &[usize], out: &mut Vec<T>)
fn read_sorted_into_at(&self, indices: &[usize], out: &mut Vec<T>)
Source§fn read_sorted_at(&self, indices: &[usize]) -> Vec<T>
fn read_sorted_at(&self, indices: &[usize]) -> Vec<T>
Vec.Source§fn read_sorted_into(&self, indices: &[I], out: &mut Vec<T>)
fn read_sorted_into(&self, indices: &[I], out: &mut Vec<T>)
out.Source§fn read_sorted(&self, indices: &[I]) -> Vec<T>
fn read_sorted(&self, indices: &[I]) -> Vec<T>
Vec.Source§fn min_at(&self, from: usize, to: usize) -> Option<T>where
Self: Sized,
T: PartialOrd,
fn min_at(&self, from: usize, to: usize) -> Option<T>where
Self: Sized,
T: PartialOrd,
[from, to) by raw index, or None if empty.Source§fn min_dyn(&self, from: usize, to: usize) -> Option<T>where
T: PartialOrd,
fn min_dyn(&self, from: usize, to: usize) -> Option<T>where
T: PartialOrd,
[from, to), or None if empty (object-safe).Source§fn max_at(&self, from: usize, to: usize) -> Option<T>where
Self: Sized,
T: PartialOrd,
fn max_at(&self, from: usize, to: usize) -> Option<T>where
Self: Sized,
T: PartialOrd,
[from, to) by raw index, or None if empty.Source§fn max_dyn(&self, from: usize, to: usize) -> Option<T>where
T: PartialOrd,
fn max_dyn(&self, from: usize, to: usize) -> Option<T>where
T: PartialOrd,
[from, to), or None if empty (object-safe).Source§impl<V> StoredVec for EagerVec<V>where
V: StoredVec,
impl<V> StoredVec for EagerVec<V>where
V: StoredVec,
Source§type ReadOnly = <V as StoredVec>::ReadOnly
type ReadOnly = <V as StoredVec>::ReadOnly
read_only_clone.Source§fn read_only_clone(&self) -> Self::ReadOnly
fn read_only_clone(&self) -> Self::ReadOnly
Source§impl<V> WritableVec<<V as TypedVec>::I, <V as TypedVec>::T> for EagerVec<V>where
V: StoredVec,
impl<V> WritableVec<<V as TypedVec>::I, <V as TypedVec>::T> for EagerVec<V>where
V: StoredVec,
fn push(&mut self, value: V::T)
Source§fn truncate_if_needed_at(&mut self, index: usize) -> Result<()>
fn truncate_if_needed_at(&mut self, index: usize) -> Result<()>
Source§fn reset_unsaved(&mut self)
fn reset_unsaved(&mut self)
Source§fn stamped_write_with_changes(&mut self, stamp: Stamp) -> Result<()>
fn stamped_write_with_changes(&mut self, stamp: Stamp) -> Result<()>
const SIZE_OF_T: usize = _
Source§fn rollback_before(&mut self, stamp: Stamp) -> Result<Stamp>
fn rollback_before(&mut self, stamp: Stamp) -> Result<Stamp>
Source§fn pushed_len(&self) -> usize
fn pushed_len(&self) -> usize
Source§fn is_pushed_empty(&self) -> bool
fn is_pushed_empty(&self) -> bool
Source§fn checked_push(&mut self, index: I, value: T) -> Result<()>
fn checked_push(&mut self, index: I, value: T) -> Result<()>
Source§fn checked_push_at(&mut self, index: usize, value: T) -> Result<()>
fn checked_push_at(&mut self, index: usize, value: T) -> Result<()>
Source§fn truncate_if_needed(&mut self, index: I) -> Result<()>
fn truncate_if_needed(&mut self, index: I) -> Result<()>
Source§fn truncate_if_needed_with_stamp(
&mut self,
index: I,
stamp: Stamp,
) -> Result<()>
fn truncate_if_needed_with_stamp( &mut self, index: I, stamp: Stamp, ) -> Result<()>
Source§fn batch_limit_reached(&self) -> bool
fn batch_limit_reached(&self) -> bool
Source§fn fill_to(&mut self, target_len: usize, value: T) -> Result<()>where
T: Copy,
fn fill_to(&mut self, target_len: usize, value: T) -> Result<()>where
T: Copy,
target_len, filling with value.
Batches writes in ~1GB chunks to avoid memory explosion.Source§fn stamped_write_maybe_with_changes(
&mut self,
stamp: Stamp,
with_changes: bool,
) -> Result<()>
fn stamped_write_maybe_with_changes( &mut self, stamp: Stamp, with_changes: bool, ) -> Result<()>
Auto Trait Implementations§
impl<V> Freeze for EagerVec<V>where
V: Freeze,
impl<V> RefUnwindSafe for EagerVec<V>where
V: RefUnwindSafe,
impl<V> Send for EagerVec<V>where
V: Send,
impl<V> Sync for EagerVec<V>where
V: Sync,
impl<V> Unpin for EagerVec<V>where
V: Unpin,
impl<V> UnsafeUnpin for EagerVec<V>where
V: UnsafeUnpin,
impl<V> UnwindSafe for EagerVec<V>where
V: UnwindSafe,
Blanket Implementations§
Source§impl<V> AnyReadableVec for V
impl<V> AnyReadableVec for V
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
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<V> ReadOnlyClone for Vwhere
V: StoredVec,
impl<V> ReadOnlyClone for Vwhere
V: StoredVec,
Source§impl<V, I, T> ReadableOptionVec<I, T> for V
impl<V, I, T> ReadableOptionVec<I, T> for V
Source§fn collect_or_default(&self) -> Vec<T>
fn collect_or_default(&self) -> Vec<T>
None with T::default().Source§fn collect_one_flat(&self, index: I) -> Option<T>
fn collect_one_flat(&self, index: I) -> Option<T>
Option<Option<T>> → Option<T>.