pub struct MemoryManager { /* private fields */ }
Expand description
Memory manager for WebAssembly models
Implementations§
Source§impl MemoryManager
impl MemoryManager
Sourcepub fn new(
config: WasmMemoryConfig,
progressive_config: ProgressiveLoadingConfig,
cache_config: CachingConfig,
parallel_config: ParallelConfig,
) -> Self
pub fn new( config: WasmMemoryConfig, progressive_config: ProgressiveLoadingConfig, cache_config: CachingConfig, parallel_config: ParallelConfig, ) -> Self
Create a new memory manager
Sourcepub fn performance_optimized() -> Self
pub fn performance_optimized() -> Self
Create a memory manager optimized for performance
Sourcepub fn resource_constrained() -> Self
pub fn resource_constrained() -> Self
Create a memory manager optimized for low resource usage
Sourcepub fn memory_config(&self) -> &WasmMemoryConfig
pub fn memory_config(&self) -> &WasmMemoryConfig
Get memory configuration
Sourcepub fn progressive_config(&self) -> &ProgressiveLoadingConfig
pub fn progressive_config(&self) -> &ProgressiveLoadingConfig
Get progressive loading configuration
Sourcepub fn cache_config(&self) -> &CachingConfig
pub fn cache_config(&self) -> &CachingConfig
Get caching configuration
Sourcepub fn parallel_config(&self) -> &ParallelConfig
pub fn parallel_config(&self) -> &ParallelConfig
Get parallel configuration
Sourcepub fn calculate_memory_requirements(
&self,
model_size: usize,
) -> MemoryRequirements
pub fn calculate_memory_requirements( &self, model_size: usize, ) -> MemoryRequirements
Calculate total memory requirements
Sourcepub fn is_suitable_for_model(&self, model_size: usize) -> bool
pub fn is_suitable_for_model(&self, model_size: usize) -> bool
Check if configuration is suitable for given model size
Sourcepub fn recommended_chunk_size(&self, model_size: usize) -> usize
pub fn recommended_chunk_size(&self, model_size: usize) -> usize
Get recommended chunk size for streaming
Auto Trait Implementations§
impl Freeze for MemoryManager
impl RefUnwindSafe for MemoryManager
impl Send for MemoryManager
impl Sync for MemoryManager
impl Unpin for MemoryManager
impl UnwindSafe for MemoryManager
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> 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