pub trait GenericStoredVec<I, T>: AnyStoredVec{
const SIZE_OF_T: usize = _;
Show 50 methods
// Required methods
fn read_value_from_bytes(&self, bytes: &[u8]) -> Result<T>;
fn write_value_to(&self, value: &T, buf: &mut Vec<u8>);
fn pushed(&self) -> &[T];
fn mut_pushed(&mut self) -> &mut Vec<T>;
fn reset(&mut self) -> Result<()>;
// Provided methods
fn create_reader(&self) -> Reader { ... }
fn read(&self, index: I, reader: &Reader) -> Result<T> { ... }
fn read_once(&self, index: I) -> Result<T> { ... }
fn read_at(&self, index: usize, reader: &Reader) -> Result<T> { ... }
fn write_values_to(&self, values: &[T], buf: &mut Vec<u8>) { ... }
fn read_at_once(&self, index: usize) -> Result<T> { ... }
fn read_unwrap(&self, index: I, reader: &Reader) -> T { ... }
fn read_unwrap_once(&self, index: I) -> T { ... }
fn read_at_unwrap(&self, index: usize, reader: &Reader) -> T { ... }
fn read_at_unwrap_once(&self, index: usize) -> T { ... }
fn get_pushed_or_read(&self, index: I, reader: &Reader) -> Result<Option<T>> { ... }
fn get_pushed_or_read_once(&self, index: I) -> Result<Option<T>> { ... }
fn get_pushed_or_read_unwrap(&self, index: I, reader: &Reader) -> T { ... }
fn get_pushed_or_read_unwrap_once(&self, index: I) -> T { ... }
fn get_pushed_or_read_at(
&self,
index: usize,
reader: &Reader,
) -> Result<Option<T>> { ... }
fn get_pushed_or_read_at_once(&self, index: usize) -> Result<Option<T>> { ... }
fn get_pushed_or_read_at_unwrap(&self, index: usize, reader: &Reader) -> T { ... }
fn get_pushed_or_read_at_unwrap_once(&self, index: usize) -> T { ... }
fn get_pushed_at(&self, index: usize, stored_len: usize) -> Option<&T> { ... }
fn len_(&self) -> usize { ... }
fn pushed_len(&self) -> usize { ... }
fn is_pushed_empty(&self) -> bool { ... }
fn has(&self, index: I) -> bool { ... }
fn has_at(&self, index: usize) -> bool { ... }
fn push(&mut self, value: T) { ... }
fn checked_push(&mut self, index: I, value: T) -> Result<()> { ... }
fn checked_push_at(&mut self, index: usize, value: T) -> Result<()> { ... }
fn truncate_push(&mut self, index: I, value: T) -> Result<()> { ... }
fn truncate_push_at(&mut self, index: usize, value: T) -> Result<()> { ... }
fn batch_limit_reached(&self) -> bool { ... }
fn fill_to(&mut self, target_len: usize, value: T) -> Result<()>
where T: Copy { ... }
fn truncate_if_needed(&mut self, index: I) -> Result<()> { ... }
fn truncate_if_needed_at(&mut self, index: usize) -> Result<()> { ... }
fn truncate_if_needed_with_stamp(
&mut self,
index: I,
stamp: Stamp,
) -> Result<()> { ... }
fn clear(&mut self) -> Result<()> { ... }
fn reset_unsaved(&mut self) { ... }
fn validate_computed_version_or_reset(
&mut self,
dep_version: Version,
) -> Result<()> { ... }
fn is_dirty(&self) -> bool { ... }
fn changes_path(&self) -> PathBuf { ... }
fn stamped_write_maybe_with_changes(
&mut self,
stamp: Stamp,
with_changes: bool,
) -> Result<()> { ... }
fn stamped_write_with_changes(&mut self, stamp: Stamp) -> Result<()> { ... }
fn rollback_before(&mut self, stamp: Stamp) -> Result<Stamp> { ... }
fn rollback(&mut self) -> Result<()> { ... }
fn deserialize_then_undo_changes(&mut self, bytes: &[u8]) -> Result<()> { ... }
fn vec_region_name(&self) -> String { ... }
}Provided Associated Constants§
Required Methods§
Sourcefn read_value_from_bytes(&self, bytes: &[u8]) -> Result<T>
fn read_value_from_bytes(&self, bytes: &[u8]) -> Result<T>
Deserializes a value from bytes. Implementors use their strategy.
Sourcefn write_value_to(&self, value: &T, buf: &mut Vec<u8>)
fn write_value_to(&self, value: &T, buf: &mut Vec<u8>)
Writes a value to the provided buffer. Implementors use their strategy.
Sourcefn mut_pushed(&mut self) -> &mut Vec<T>
fn mut_pushed(&mut self) -> &mut Vec<T>
Returns a mutable reference to the current pushed (uncommitted) values.
Provided Methods§
Sourcefn create_reader(&self) -> Reader
fn create_reader(&self) -> Reader
Creates a reader to the underlying region. Be careful with deadlocks - drop the reader before mutable ops.
Sourcefn read(&self, index: I, reader: &Reader) -> Result<T>
fn read(&self, index: I, reader: &Reader) -> Result<T>
Reads value at index using provided reader.
Sourcefn read_once(&self, index: I) -> Result<T>
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.
Sourcefn read_at(&self, index: usize, reader: &Reader) -> Result<T>
fn read_at(&self, index: usize, reader: &Reader) -> Result<T>
Reads value at usize index using provided reader.
Sourcefn write_values_to(&self, values: &[T], buf: &mut Vec<u8>)
fn write_values_to(&self, values: &[T], buf: &mut Vec<u8>)
Writes multiple values to the provided buffer.
Sourcefn read_at_once(&self, index: usize) -> Result<T>
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.
Sourcefn read_unwrap(&self, index: I, reader: &Reader) -> T
fn read_unwrap(&self, index: I, reader: &Reader) -> T
Reads value at index using provided reader. Panics if read fails.
Sourcefn read_unwrap_once(&self, index: I) -> T
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.
Sourcefn read_at_unwrap(&self, index: usize, reader: &Reader) -> T
fn read_at_unwrap(&self, index: usize, reader: &Reader) -> T
Reads value at usize index using provided reader. Panics if read fails.
Sourcefn read_at_unwrap_once(&self, index: usize) -> T
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.
Sourcefn get_pushed_or_read(&self, index: I, reader: &Reader) -> Result<Option<T>>
fn get_pushed_or_read(&self, index: I, reader: &Reader) -> Result<Option<T>>
Gets value from pushed layer or storage using provided reader.
Sourcefn get_pushed_or_read_once(&self, index: I) -> Result<Option<T>>
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.
Sourcefn get_pushed_or_read_unwrap(&self, index: I, reader: &Reader) -> T
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.
Sourcefn get_pushed_or_read_unwrap_once(&self, index: I) -> T
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.
Sourcefn get_pushed_or_read_at(
&self,
index: usize,
reader: &Reader,
) -> Result<Option<T>>
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.
Sourcefn get_pushed_or_read_at_once(&self, index: usize) -> Result<Option<T>>
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.
Sourcefn get_pushed_or_read_at_unwrap(&self, index: usize, reader: &Reader) -> T
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.
Sourcefn get_pushed_or_read_at_unwrap_once(&self, index: usize) -> T
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.
Sourcefn get_pushed_at(&self, index: usize, stored_len: usize) -> Option<&T>
fn get_pushed_at(&self, index: usize, stored_len: usize) -> Option<&T>
Gets value from pushed layer only (no disk reads).
Sourcefn len_(&self) -> usize
fn len_(&self) -> usize
Returns the length including both stored and pushed (uncommitted) values.
Named len_ to avoid conflict with AnyVec::len.
Total length = stored_len() + pushed_len()
Sourcefn pushed_len(&self) -> usize
fn pushed_len(&self) -> usize
Returns the number of pushed (uncommitted) values in the memory buffer.
Sourcefn is_pushed_empty(&self) -> bool
fn is_pushed_empty(&self) -> bool
Returns true if there are no pushed (uncommitted) values.
Sourcefn checked_push(&mut self, index: I, value: T) -> Result<()>
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.
Sourcefn checked_push_at(&mut self, index: usize, value: T) -> Result<()>
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.
Sourcefn truncate_push(&mut self, index: I, value: T) -> Result<()>
fn truncate_push(&mut self, index: I, value: T) -> Result<()>
Pushes a value at the given index, truncating if necessary.
Sourcefn truncate_push_at(&mut self, index: usize, value: T) -> Result<()>
fn truncate_push_at(&mut self, index: usize, value: T) -> Result<()>
Pushes a value at the given usize index, truncating if necessary.
Sourcefn batch_limit_reached(&self) -> bool
fn batch_limit_reached(&self) -> bool
Returns true if the pushed cache has reached the batch limit (~1GiB).
When this limit is reached, the caller should flush to disk before continuing. This prevents excessive memory usage during bulk operations.
Sourcefn 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,
Extends the vector to target_len, filling with value.
Batches writes in ~1GB chunks to avoid memory explosion.
Sourcefn truncate_if_needed(&mut self, index: I) -> Result<()>
fn truncate_if_needed(&mut self, index: I) -> Result<()>
Truncates the vector to the given index if the current length exceeds it.
Sourcefn truncate_if_needed_at(&mut self, index: usize) -> Result<()>
fn truncate_if_needed_at(&mut self, index: usize) -> Result<()>
Truncates the vector to the given usize index if the current length exceeds it.
Sourcefn 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<()>
Truncates the vector to the given index if needed, updating the stamp.
Sourcefn reset_unsaved(&mut self)
fn reset_unsaved(&mut self)
Resets uncommitted changes.
Sourcefn validate_computed_version_or_reset(
&mut self,
dep_version: Version,
) -> Result<()>
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.
Sourcefn changes_path(&self) -> PathBuf
fn changes_path(&self) -> PathBuf
Returns the path to the changes directory for this vector.
Sourcefn 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<()>
Flushes with the given stamp, optionally saving changes for rollback.
Sourcefn stamped_write_with_changes(&mut self, stamp: Stamp) -> Result<()>
fn stamped_write_with_changes(&mut self, stamp: Stamp) -> Result<()>
Flushes with the given stamp, saving changes to enable rollback.
Sourcefn rollback_before(&mut self, stamp: Stamp) -> Result<Stamp>
fn rollback_before(&mut self, stamp: Stamp) -> Result<Stamp>
Rolls back changes to before the given stamp.
Sourcefn deserialize_then_undo_changes(&mut self, bytes: &[u8]) -> Result<()>
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.
Sourcefn vec_region_name(&self) -> String
fn vec_region_name(&self) -> String
Returns the region name for this vector.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.