pub struct SoAStorage { /* private fields */ }Expand description
SoA storage for symbol data
Layout: [id_array][package_id_array][kind_array][visibility_array][name_offset_array]… Each array is contiguous in memory for cache efficiency
Implementations§
Source§impl SoAStorage
impl SoAStorage
Sourcepub fn new(
symbol_capacity: usize,
string_pool_capacity: usize,
package_capacity: usize,
) -> Self
pub fn new( symbol_capacity: usize, string_pool_capacity: usize, package_capacity: usize, ) -> Self
Create new SoA storage with initial capacity
Sourcepub fn symbol_count(&self) -> usize
pub fn symbol_count(&self) -> usize
Get symbol count
Sourcepub fn package_count(&self) -> usize
pub fn package_count(&self) -> usize
Get package count
Sourcepub fn insert_symbol(&self, symbol: Symbol) -> Result<SymbolId>
pub fn insert_symbol(&self, symbol: Symbol) -> Result<SymbolId>
Insert a new symbol
Sourcepub fn get_symbol(&self, id: SymbolId) -> Option<Symbol>
pub fn get_symbol(&self, id: SymbolId) -> Option<Symbol>
Get symbol by ID - O(1) direct indexing
Sourcepub fn get_symbol_names<'a>(
&self,
start: usize,
count: usize,
string_pool: &'a [u8],
) -> Vec<&'a str>
pub fn get_symbol_names<'a>( &self, start: usize, count: usize, string_pool: &'a [u8], ) -> Vec<&'a str>
Batch get symbol names - cache-friendly sequential access
Sourcepub fn insert_string(&self, s: &str) -> (u32, u16)
pub fn insert_string(&self, s: &str) -> (u32, u16)
Insert string into pool, return offset
Sourcepub fn insert_package(&self, package: Package) -> Result<PackageId>
pub fn insert_package(&self, package: Package) -> Result<PackageId>
Insert package
Sourcepub fn get_package(&self, id: PackageId) -> Option<Package>
pub fn get_package(&self, id: PackageId) -> Option<Package>
Get package by ID
Sourcepub fn iter_symbols(&self) -> impl Iterator<Item = Symbol> + '_
pub fn iter_symbols(&self) -> impl Iterator<Item = Symbol> + '_
Iterate over all symbols in cache-friendly order
Sourcepub fn memory_usage(&self) -> usize
pub fn memory_usage(&self) -> usize
Get memory usage statistics
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SoAStorage
impl RefUnwindSafe for SoAStorage
impl Unpin for SoAStorage
impl UnsafeUnpin for SoAStorage
impl UnwindSafe for SoAStorage
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
Mutably borrows from an owned value. Read more
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