Skip to main content

EagerVec

Struct EagerVec 

Source
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,

Source

pub fn compute_sum_of_others<O>( &mut self, max_from: V::I, others: &[&O], exit: &Exit, ) -> Result<()>
where O: IterableVec<V::I, V::T>, V::T: Add<V::T, Output = V::T>,

Source

pub fn compute_min_of_others<O>( &mut self, max_from: V::I, others: &[&O], exit: &Exit, ) -> Result<()>
where O: IterableVec<V::I, V::T>, V::T: Add<V::T, Output = V::T> + Ord,

Source

pub fn compute_max_of_others<O>( &mut self, max_from: V::I, others: &[&O], exit: &Exit, ) -> Result<()>
where O: IterableVec<V::I, V::T>, V::T: Add<V::T, Output = V::T> + Ord,

Source

pub fn compute_weighted_average_of_others<W, OW, OV>( &mut self, max_from: V::I, weights: &[&OW], values: &[&OV], exit: &Exit, ) -> Result<()>
where W: VecValue + Into<f64>, OW: IterableVec<V::I, W>, OV: IterableVec<V::I, V::T>, V::T: Into<f64> + From<f64>,

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.

Source

pub fn compute_sum_from_indexes<A, B>( &mut self, max_from: V::I, first_indexes: &impl IterableVec<V::I, A>, indexes_count: &impl IterableVec<V::I, B>, source: &impl IterableVec<A, V::T>, exit: &Exit, ) -> Result<()>

Source

pub fn compute_filtered_sum_from_indexes<A, B>( &mut self, max_from: V::I, first_indexes: &impl IterableVec<V::I, A>, indexes_count: &impl IterableVec<V::I, B>, source: &impl IterableVec<A, V::T>, filter: impl FnMut(&V::T) -> bool, exit: &Exit, ) -> Result<()>

Source

pub fn compute_count_from_indexes<A, B>( &mut self, max_from: V::I, first_indexes: &impl IterableVec<V::I, A>, other_to_else: &impl IterableVec<A, B>, exit: &Exit, ) -> Result<()>
where V::T: From<A>, A: VecValue + VecIndex + Copy + Add<usize, Output = A> + CheckedSub<A> + TryInto<V::T> + Default, <A as TryInto<V::T>>::Error: Error + 'static, B: VecValue,

Source

pub fn compute_filtered_count_from_indexes<A, B>( &mut self, max_from: V::I, first_indexes: &impl IterableVec<V::I, A>, other_to_else: &impl IterableVec<A, B>, filter: impl FnMut(A) -> bool, exit: &Exit, ) -> Result<()>
where V::T: From<A>, A: VecValue + VecIndex + Copy + Add<usize, Output = A> + CheckedSub<A> + TryInto<V::T> + Default, B: VecValue, <A as TryInto<V::T>>::Error: Error + 'static,

Source§

impl<V> EagerVec<V>
where V: StoredVec,

Source

pub fn compute_add( &mut self, max_from: V::I, added: &impl IterableVec<V::I, V::T>, adder: &impl IterableVec<V::I, V::T>, exit: &Exit, ) -> Result<()>
where V::T: Add<Output = V::T>,

Source

pub fn compute_subtract( &mut self, max_from: V::I, subtracted: &impl IterableVec<V::I, V::T>, subtracter: &impl IterableVec<V::I, V::T>, exit: &Exit, ) -> Result<()>
where V::T: CheckedSub,

Source

pub fn compute_multiply<A, B>( &mut self, max_from: V::I, multiplied: &impl IterableVec<V::I, A>, multiplier: &impl IterableVec<V::I, B>, exit: &Exit, ) -> Result<()>
where A: VecValue, B: VecValue, V::T: From<A> + Mul<B, Output = V::T>,

Source

pub fn compute_divide<A, B>( &mut self, max_from: V::I, divided: &impl IterableVec<V::I, A>, divider: &impl IterableVec<V::I, B>, exit: &Exit, ) -> Result<()>
where A: VecValue, B: VecValue, V::T: From<A> + Div<B, Output = V::T>,

Source

pub fn compute_percentage<A, B>( &mut self, max_from: V::I, divided: &impl IterableVec<V::I, A>, divider: &impl IterableVec<V::I, B>, exit: &Exit, ) -> Result<()>
where A: VecValue, B: VecValue, V::T: From<A> + From<B> + From<u8> + Mul<V::T, Output = V::T> + Div<V::T, Output = V::T> + Sub<V::T, Output = V::T> + Copy,

Source

pub fn compute_percentage_difference<A, B>( &mut self, max_from: V::I, divided: &impl IterableVec<V::I, A>, divider: &impl IterableVec<V::I, B>, exit: &Exit, ) -> Result<()>
where A: VecValue, B: VecValue, V::T: From<A> + From<B> + From<u8> + Mul<V::T, Output = V::T> + Div<V::T, Output = V::T> + Sub<V::T, Output = V::T> + Copy,

Source§

impl<V> EagerVec<V>
where V: StoredVec,

Source

pub fn compute_cumulative<S>( &mut self, max_from: V::I, source: &impl IterableVec<V::I, S>, exit: &Exit, ) -> Result<()>
where S: VecValue + Into<V::T>, V::T: From<usize> + AddAssign + Copy,

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.

Source

pub fn compute_cumulative_binary<S1, S2>( &mut self, max_from: V::I, source1: &impl IterableVec<V::I, S1>, source2: &impl IterableVec<V::I, S2>, exit: &Exit, ) -> Result<()>
where S1: VecValue + Into<V::T>, S2: VecValue + Into<V::T>, V::T: From<usize> + AddAssign + Add<Output = V::T> + Copy,

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.

Source

pub fn compute_cumulative_transformed_binary<S1, S2, F>( &mut self, max_from: V::I, source1: &impl IterableVec<V::I, S1>, source2: &impl IterableVec<V::I, S2>, transform: F, exit: &Exit, ) -> Result<()>
where S1: VecValue, S2: VecValue, V::T: From<usize> + AddAssign + Copy, F: FnMut(S1, S2) -> V::T,

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.

Source

pub fn compute_cumulative_count<S, P>( &mut self, max_from: V::I, source: &impl IterableVec<V::I, S>, predicate: P, exit: &Exit, ) -> Result<()>
where S: VecValue, V::T: From<usize> + AddAssign + Copy, P: Fn(&S) -> bool,

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.

Source

pub fn compute_rolling_count<S, P>( &mut self, max_from: V::I, source: &impl IterableVec<V::I, S>, window_size: usize, predicate: P, exit: &Exit, ) -> Result<()>
where S: VecValue, V::T: From<usize> + Copy, P: Fn(&S) -> bool,

Compute rolling count of values matching a predicate within a window.

Source

pub fn compute_cumulative_count_from<S, P>( &mut self, max_from: V::I, source: &impl IterableVec<V::I, S>, from: V::I, predicate: P, exit: &Exit, ) -> Result<()>
where S: VecValue, V::T: From<usize> + AddAssign + Copy, P: Fn(&S) -> bool,

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>
where V: StoredVec, V::I: CheckedSub,

Source

pub fn compute_previous_value<A>( &mut self, max_from: V::I, source: &impl IterableVec<V::I, A>, len: usize, exit: &Exit, ) -> Result<()>
where A: VecValue + Default, f32: From<A>, V::T: From<f32>,

Source

pub fn compute_change<A>( &mut self, max_from: V::I, source: &impl IterableVec<V::I, A>, len: usize, exit: &Exit, ) -> Result<()>
where A: VecValue + Default + Into<V::T>, V::T: CheckedSub + Default,

Compute N-period change. Converts source values to output type before subtraction to properly handle negative changes (e.g., unsigned source to signed output).

Source

pub fn compute_percentage_change<A>( &mut self, max_from: V::I, source: &impl IterableVec<V::I, A>, len: usize, exit: &Exit, ) -> Result<()>
where A: VecValue + Default, f32: From<A>, V::T: From<f32>,

Source

pub fn compute_cagr<A>( &mut self, max_from: V::I, percentage_returns: &impl IterableVec<V::I, A>, days: usize, exit: &Exit, ) -> Result<()>
where A: VecValue + Default, f32: From<A>, V::T: From<f32>,

Source§

impl<V> EagerVec<V>
where V: StoredVec,

Source

pub fn compute_max<A>( &mut self, max_from: V::I, source: &impl IterableVec<V::I, A>, window: usize, exit: &Exit, ) -> Result<()>
where A: VecValue + Ord, V::T: From<A>,

Source

pub fn compute_min<A>( &mut self, max_from: V::I, source: &impl IterableVec<V::I, A>, window: usize, exit: &Exit, ) -> Result<()>
where A: VecValue + Ord, V::T: From<A>,

Source

pub fn compute_sum<A>( &mut self, max_from: V::I, source: &impl IterableVec<V::I, A>, window: usize, exit: &Exit, ) -> Result<()>
where V::T: Add<V::T, Output = V::T> + From<A> + Default + CheckedSub, A: VecValue,

Source

pub fn compute_rolling_sum<A>( &mut self, max_from: V::I, window_starts: &impl IterableVec<V::I, V::I>, values: &impl IterableVec<V::I, A>, exit: &Exit, ) -> Result<()>
where A: VecValue, V::T: From<A> + Default + AddAssign + SubAssign,

Compute rolling sum with variable window starts. For each index i, computes sum of values from window_starts[i] to i (inclusive).

Source

pub fn compute_sma<A>( &mut self, max_from: V::I, source: &impl IterableVec<V::I, A>, sma: usize, exit: &Exit, ) -> Result<()>
where V::T: Add<V::T, Output = V::T> + From<A> + From<f32>, A: VecValue, f32: From<V::T> + From<A>,

Source

pub fn compute_sma_<A>( &mut self, max_from: V::I, source: &impl IterableVec<V::I, A>, window: usize, exit: &Exit, min_i: Option<V::I>, ) -> Result<()>
where V::T: Add<V::T, Output = V::T> + From<A> + From<f32>, A: VecValue, f32: From<V::T> + From<A>,

Source

pub fn compute_rolling_median<A>( &mut self, max_from: V::I, source: &impl IterableVec<V::I, A>, window: usize, exit: &Exit, ) -> Result<()>
where V::T: From<f32>, A: VecValue, f32: From<A>,

Source

pub fn compute_ema<A>( &mut self, max_from: V::I, source: &impl CollectableVec<V::I, A>, ema: usize, exit: &Exit, ) -> Result<()>
where V::T: From<A> + From<f32>, A: VecValue + Sum, f32: From<A> + From<V::T>,

Source

pub fn compute_ema_<A>( &mut self, max_from: V::I, source: &impl CollectableVec<V::I, A>, ema: usize, exit: &Exit, min_i: Option<V::I>, ) -> Result<()>
where V::T: From<A> + From<f32>, A: VecValue + Sum, f32: From<A> + From<V::T>,

Source

pub fn compute_rma<A>( &mut self, max_from: V::I, source: &impl CollectableVec<V::I, A>, period: usize, exit: &Exit, ) -> Result<()>
where V::T: From<A> + From<f32>, A: VecValue + Sum, f32: From<A> + From<V::T>,

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.

Source

pub fn compute_all_time_high<A>( &mut self, max_from: V::I, source: &impl IterableVec<V::I, A>, exit: &Exit, ) -> Result<()>
where V::T: From<A> + Ord + Default, A: VecValue,

Computes the all time high of a source. This version is more optimized than compute_max with a window set to usize::MAX.

Source

pub fn compute_all_time_low<A>( &mut self, max_from: V::I, source: &impl IterableVec<V::I, A>, exit: &Exit, ) -> Result<()>
where V::T: From<A> + Ord + Default, A: VecValue,

Computes the all time low of a source. This version is more optimized than compute_min with a window set to usize::MAX.

Source

pub fn compute_all_time_low_<A>( &mut self, max_from: V::I, source: &impl IterableVec<V::I, A>, exit: &Exit, exclude_default: bool, ) -> Result<()>
where V::T: From<A> + Ord + Default, A: VecValue,

Computes the all time low of a source. This version is more optimized than compute_min with a window set to usize::MAX.

Source

pub fn compute_all_time_high_from<A>( &mut self, max_from: V::I, source: &impl IterableVec<V::I, A>, from: V::I, exit: &Exit, ) -> Result<()>
where V::T: From<A> + Ord + Default + Copy, A: VecValue,

Computes the all time high starting from a specific index. Values before from will be the default value (typically 0).

Source

pub fn compute_all_time_low_from<A>( &mut self, max_from: V::I, source: &impl IterableVec<V::I, A>, from: V::I, exit: &Exit, ) -> Result<()>
where V::T: From<A> + Ord + Default + Copy, A: VecValue,

Computes the all time low starting from a specific index. Values before from will be the default value (typically 0).

Source

pub fn compute_zscore<A, B, C>( &mut self, max_from: V::I, source: &impl IterableVec<V::I, A>, sma: &impl IterableVec<V::I, B>, sd: &impl IterableVec<V::I, C>, exit: &Exit, ) -> Result<()>
where V::T: From<f32>, A: VecValue + Sub<B, Output = A> + Div<C, Output = V::T>, B: VecValue, C: VecValue, f32: From<A> + From<B> + From<C>,

Source§

impl<V> EagerVec<V>
where V: StoredVec,

Source

pub fn compute_to<F>( &mut self, max_from: V::I, to: usize, version: Version, t: F, exit: &Exit, ) -> Result<()>
where F: FnMut(V::I) -> (V::I, V::T),

Source

pub fn compute_range<A, F>( &mut self, max_from: V::I, other: &impl IterableVec<V::I, A>, t: F, exit: &Exit, ) -> Result<()>
where A: VecValue, F: FnMut(V::I) -> (V::I, V::T),

Source

pub fn compute_from_index<A>( &mut self, max_from: V::I, other: &impl IterableVec<V::I, A>, exit: &Exit, ) -> Result<()>
where V::T: From<V::I>, A: VecValue,

Source

pub fn compute_transform<A, F>( &mut self, max_from: V::I, other: &impl IterableVec<V::I, A>, t: F, exit: &Exit, ) -> Result<()>
where A: VecValue, F: FnMut((V::I, A, &Self)) -> (V::I, V::T),

Source

pub fn compute_transform2<A, B, F>( &mut self, max_from: V::I, other1: &impl IterableVec<V::I, A>, other2: &impl IterableVec<V::I, B>, t: F, exit: &Exit, ) -> Result<()>
where A: VecValue, B: VecValue, F: FnMut((V::I, A, B, &Self)) -> (V::I, V::T),

Source

pub fn compute_transform3<A, B, C, F>( &mut self, max_from: V::I, other1: &impl IterableVec<V::I, A>, other2: &impl IterableVec<V::I, B>, other3: &impl IterableVec<V::I, C>, t: F, exit: &Exit, ) -> Result<()>
where A: VecValue, B: VecValue, C: VecValue, F: FnMut((V::I, A, B, C, &Self)) -> (V::I, V::T),

Source

pub fn compute_transform4<A, B, C, D, F>( &mut self, max_from: V::I, other1: &impl IterableVec<V::I, A>, other2: &impl IterableVec<V::I, B>, other3: &impl IterableVec<V::I, C>, other4: &impl IterableVec<V::I, D>, t: F, exit: &Exit, ) -> Result<()>
where A: VecValue, B: VecValue, C: VecValue, D: VecValue, F: FnMut((V::I, A, B, C, D, &Self)) -> (V::I, V::T),

Source

pub fn compute_coarser( &mut self, max_from: V::T, other: &impl IterableVec<V::T, V::I>, exit: &Exit, ) -> Result<()>
where V::I: VecValue + VecIndex, V::T: VecIndex,

Source§

impl<V> EagerVec<V>
where V: StoredVec,

Source

pub fn inner_version(&self) -> Version

Source

pub fn remove(self) -> Result<()>

Removes this vector and all its associated regions from the database

Trait Implementations§

Source§

impl<V> AnyStoredVec for EagerVec<V>
where V: StoredVec,

Source§

fn db_path(&self) -> PathBuf

Source§

fn region(&self) -> &Region

Source§

fn header(&self) -> &Header

Source§

fn mut_header(&mut self) -> &mut Header

Source§

fn saved_stamped_changes(&self) -> u16

Number of stamped change files to keep for rollback support.
Source§

fn stored_len(&self) -> usize

The effective stored length (may differ from real_stored_len during truncation).
Source§

fn real_stored_len(&self) -> usize

The actual length stored on disk.
Source§

fn serialize_changes(&self) -> Result<Vec<u8>>

Source§

fn any_stamped_write_with_changes(&mut self, stamp: Stamp) -> Result<()>

Flushes with the given stamp, saving changes to enable rollback. Named with trailing underscore to avoid conflict with GenericStoredVec method.
Source§

fn remove(self) -> Result<()>

Removes this vector’s region from the database.
Source§

fn any_reset(&mut self) -> Result<()>

Resets the vector state, clearing all data.
Source§

fn flush(&mut self) -> Result<()>

Source§

fn update_stamp(&mut self, stamp: Stamp)

Source§

fn stamp(&self) -> Stamp

Source§

fn stamped_write(&mut self, stamp: Stamp) -> Result<()>

Source§

fn any_stamped_write_maybe_with_changes( &mut self, stamp: Stamp, with_changes: bool, ) -> Result<()>

Flushes with the given stamp, optionally saving changes for rollback.
Source§

impl<V> AnyVec for EagerVec<V>
where V: StoredVec,

Source§

fn version(&self) -> Version

Source§

fn name(&self) -> &str

Source§

fn len(&self) -> usize

Source§

fn index_type_to_string(&self) -> &'static str

Returns the string representation of the index type.
Source§

fn value_type_to_size_of(&self) -> usize

Returns the size in bytes of the value type.
Source§

fn value_type_to_string(&self) -> &'static str

Returns the short type name of the value type (e.g., “Sats”, “StoredF64”).
Source§

fn region_names(&self) -> Vec<String>

Returns the list of region names used by this vector.
Source§

fn is_empty(&self) -> bool

Source§

fn region_name(&self) -> String

Returns the combined name of the vector.
Source§

fn etag(&self, stamp: Stamp, to: Option<i64>) -> String

Generates an ETag for this vector based on stamp and optional end index.
Source§

fn i64_to_usize(&self, i: i64) -> usize

Converts an i64 index to usize, supporting negative indexing (Python-style).
Source§

impl<V: Clone> Clone for EagerVec<V>

Source§

fn clone(&self) -> EagerVec<V>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<V: Debug> Debug for EagerVec<V>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<V> GenericStoredVec<<V as TypedVec>::I, <V as TypedVec>::T> for EagerVec<V>
where V: StoredVec,

Source§

fn read_value_from_bytes(&self, bytes: &[u8]) -> Result<V::T>

Deserializes a value from bytes. Implementors use their strategy.
Source§

fn write_value_to(&self, value: &V::T, buf: &mut Vec<u8>)

Writes a value to the provided buffer. Implementors use their strategy.
Source§

fn pushed(&self) -> &[V::T]

Returns the current pushed (uncommitted) values.
Source§

fn mut_pushed(&mut self) -> &mut Vec<V::T>

Returns a mutable reference to the current pushed (uncommitted) values.
Source§

fn truncate_if_needed(&mut self, index: V::I) -> Result<()>

Truncates the vector to the given index if the current length exceeds it.
Source§

fn reset(&mut self) -> Result<()>

Resets the vector state.
Source§

const SIZE_OF_T: usize = _

Source§

fn create_reader(&self) -> Reader

Creates a reader to the underlying region. Be careful with deadlocks - drop the reader before mutable ops.
Source§

fn read(&self, index: I, reader: &Reader) -> Result<T>

Reads value at index using provided reader.
Source§

fn read_once(&self, index: I) -> Result<T>

Reads value at index, creating a temporary reader. For multiple reads, prefer read() with a reused reader.
Source§

fn read_at(&self, index: usize, reader: &Reader) -> Result<T>

Reads value at usize index using provided reader.
Source§

fn write_values_to(&self, values: &[T], buf: &mut Vec<u8>)

Writes multiple values to the provided buffer.
Source§

fn read_at_once(&self, index: usize) -> Result<T>

Reads value at usize index, creating a temporary reader. For multiple reads, prefer read_at() with a reused reader.
Source§

fn read_unwrap(&self, index: I, reader: &Reader) -> T

Reads value at index using provided reader. Panics if read fails.
Source§

fn read_unwrap_once(&self, index: I) -> T

Reads value at index, creating a temporary reader. Panics if read fails. For multiple reads, prefer read_unwrap() with a reused reader.
Source§

fn read_at_unwrap(&self, index: usize, reader: &Reader) -> T

Reads value at usize index using provided reader. Panics if read fails.
Source§

fn read_at_unwrap_once(&self, index: usize) -> T

Reads value at usize index, creating a temporary reader. Panics if read fails. For multiple reads, prefer read_at_unwrap() with a reused reader.
Source§

fn get_pushed_or_read(&self, index: I, reader: &Reader) -> Result<Option<T>>

Gets value from pushed layer or storage using provided reader.
Source§

fn get_pushed_or_read_once(&self, index: I) -> Result<Option<T>>

Gets value from pushed layer or storage, creating a temporary reader. For multiple reads, prefer get_pushed_or_read() with a reused reader.
Source§

fn get_pushed_or_read_unwrap(&self, index: I, reader: &Reader) -> T

Gets value from pushed layer or storage using provided reader, unwrapping the result. Panics if the read fails or if the value doesn’t exist.
Source§

fn get_pushed_or_read_unwrap_once(&self, index: I) -> T

Gets value from pushed layer or storage, unwrapping the result. Panics if the read fails or if the value doesn’t exist. For multiple reads, prefer get_pushed_or_read_unwrap() with a reused reader.
Source§

fn get_pushed_or_read_at( &self, index: usize, reader: &Reader, ) -> Result<Option<T>>

Gets value from pushed layer or storage at usize index using provided reader. Does not check the updated layer.
Source§

fn get_pushed_or_read_at_once(&self, index: usize) -> Result<Option<T>>

Gets value from pushed layer or storage at usize index, creating a temporary reader. For multiple reads, prefer get_pushed_or_read_at() with a reused reader.
Source§

fn get_pushed_or_read_at_unwrap(&self, index: usize, reader: &Reader) -> T

Gets value from pushed layer or storage at usize index using provided reader, unwrapping the result. Panics if the read fails or if the value doesn’t exist.
Source§

fn get_pushed_or_read_at_unwrap_once(&self, index: usize) -> T

Gets value from pushed layer or storage at usize index, unwrapping the result. Panics if the read fails or if the value doesn’t exist. For multiple reads, prefer get_pushed_or_read_at_unwrap() with a reused reader.
Source§

fn get_pushed_at(&self, index: usize, stored_len: usize) -> Option<&T>

Gets value from pushed layer only (no disk reads).
Source§

fn len_(&self) -> usize

Returns the length including both stored and pushed (uncommitted) values. Read more
Source§

fn pushed_len(&self) -> usize

Returns the number of pushed (uncommitted) values in the memory buffer.
Source§

fn is_pushed_empty(&self) -> bool

Returns true if there are no pushed (uncommitted) values.
Source§

fn has(&self, index: I) -> bool

Returns true if the index is within the length.
Source§

fn has_at(&self, index: usize) -> bool

Returns true if the usize index is within the length.
Source§

fn push(&mut self, value: T)

Pushes a new value to the end of the vector.
Source§

fn checked_push(&mut self, index: I, value: T) -> Result<()>

Pushes a value at the given index, erroring if index != current length. Use this when you expect to always append in order.
Source§

fn checked_push_at(&mut self, index: usize, value: T) -> Result<()>

Pushes a value at the given usize index, erroring if index != current length. Use this when you expect to always append in order.
Source§

fn truncate_push(&mut self, index: I, value: T) -> Result<()>

Pushes a value at the given index, truncating if necessary.
Source§

fn truncate_push_at(&mut self, index: usize, value: T) -> Result<()>

Pushes a value at the given usize index, truncating if necessary.
Source§

fn batch_limit_reached(&self) -> bool

Returns true if the pushed cache has reached the batch limit (~1GiB). Read more
Source§

fn fill_to(&mut self, target_len: usize, value: T) -> Result<()>
where T: Copy,

Extends the vector to target_len, filling with value. Batches writes in ~1GB chunks to avoid memory explosion.
Source§

fn truncate_if_needed_at(&mut self, index: usize) -> Result<()>

Truncates the vector to the given usize index if the current length exceeds it.
Source§

fn truncate_if_needed_with_stamp( &mut self, index: I, stamp: Stamp, ) -> Result<()>

Truncates the vector to the given index if needed, updating the stamp.
Source§

fn clear(&mut self) -> Result<()>

Clears all values from the vector.
Source§

fn reset_unsaved(&mut self)

Resets uncommitted changes.
Source§

fn validate_computed_version_or_reset( &mut self, dep_version: Version, ) -> Result<()>

Validates the computed version against the stored version, resetting if they don’t match. Automatically includes the vec’s own version - only pass dependency versions.
Source§

fn is_dirty(&self) -> bool

Returns true if there are uncommitted changes (pushed values).
Source§

fn changes_path(&self) -> PathBuf

Returns the path to the changes directory for this vector.
Source§

fn stamped_write_maybe_with_changes( &mut self, stamp: Stamp, with_changes: bool, ) -> Result<()>

Flushes with the given stamp, optionally saving changes for rollback.
Source§

fn stamped_write_with_changes(&mut self, stamp: Stamp) -> Result<()>

Flushes with the given stamp, saving changes to enable rollback.
Source§

fn rollback_before(&mut self, stamp: Stamp) -> Result<Stamp>

Rolls back changes to before the given stamp.
Source§

fn rollback(&mut self) -> Result<()>

Rolls back the most recent change set.
Source§

fn deserialize_then_undo_changes(&mut self, bytes: &[u8]) -> Result<()>

Deserializes change data and undoes those changes. Base implementation handles pushed and truncated data. RawVecInner overrides for holes/updated.
Source§

fn vec_region_name(&self) -> String

Returns the region name for this vector.
Source§

impl<V: ImportableVec> ImportableVec for EagerVec<V>

Source§

fn import(db: &Database, name: &str, version: Version) -> Result<Self>

Import from database, creating if needed.
Source§

fn import_with(options: ImportOptions<'_>) -> Result<Self>

Import with custom options.
Source§

fn forced_import(db: &Database, name: &str, version: Version) -> Result<Self>

Import from database, resetting on version/format mismatch.
Source§

fn forced_import_with(options: ImportOptions<'_>) -> Result<Self>

Forced import with custom options.
Source§

impl<'a, V> IntoIterator for &'a EagerVec<V>
where V: StoredVec, &'a V: IntoIterator<Item = V::T>,

Source§

type Item = <V as TypedVec>::T

The type of the elements being iterated over.
Source§

type IntoIter = <&'a V as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<V> IterableVec<<V as TypedVec>::I, <V as TypedVec>::T> for EagerVec<V>
where V: StoredVec,

Source§

fn iter(&self) -> BoxedVecIterator<'_, V::I, V::T>

Source§

fn create_lookback( &self, skip: usize, window: usize, min_start: usize, ) -> Lookback<'_, I, T>
where I: VecIndex, T: VecValue,

Create a windowed lookback for efficient windowed access. Uses a ring buffer if many items will be processed, otherwise uses direct access.
Source§

impl<V> TypedVec for EagerVec<V>
where V: StoredVec,

Source§

type I = <V as TypedVec>::I

The index type used to address elements in this vector.
Source§

type T = <V as TypedVec>::T

The value type stored in this vector.

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> UnwindSafe for EagerVec<V>
where V: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<V> AnyCollectableVec for V
where V: TypedVec + CollectableVec<<V as TypedVec>::I, <V as TypedVec>::T>,

Source§

fn range_count(&self, from: Option<i64>, to: Option<i64>) -> usize

Returns the number of items in the specified range.
Source§

fn range_weight(&self, from: Option<i64>, to: Option<i64>) -> usize

Returns the total size in bytes of items in the specified range.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<I, T, V> CollectableVec<I, T> for V
where V: IterableVec<I, T> + Clone, I: VecIndex, T: VecValue,

Source§

fn iter_range( &self, from: Option<usize>, to: Option<usize>, ) -> impl Iterator<Item = T>

Returns an iterator over the specified range.
Source§

fn iter_signed_range( &self, from: Option<i64>, to: Option<i64>, ) -> impl Iterator<Item = T>

Returns an iterator over the specified range using signed indices (supports negative indexing).
Source§

fn collect(&self) -> Vec<T>

Collects all values into a Vec.
Source§

fn collect_range(&self, from: Option<usize>, to: Option<usize>) -> Vec<T>

Collects values in the specified range into a Vec.
Source§

fn collect_signed_range(&self, from: Option<i64>, to: Option<i64>) -> Vec<T>

Collects values in the specified range into a Vec using signed indices.
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<I, T, U> IterableCloneableVec<I, T> for U
where U: 'static + IterableVec<I, T> + Clone,

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V> AnyExportableVec for V

Source§

impl<I, T, U> IterableStoredVec<I, T> for U
where U: 'static + IterableVec<I, T> + AnyStoredVec,

Source§

impl<V> StoredVec for V
where V: ImportableVec + TypedVec + GenericStoredVec<<V as TypedVec>::I, <V as TypedVec>::T> + CollectableVec<<V as TypedVec>::I, <V as TypedVec>::T> + Clone, <V as TypedVec>::I: VecIndex, <V as TypedVec>::T: VecValue,

Source§

impl<T> VecValue for T
where T: Debug + Clone + Send + Sync + 'static,