pub struct StrategyFactory { /* private fields */ }
Expand description
Strategy factory for creating appropriate tracker implementations Provides centralized strategy creation with proper configuration
Implementations§
Source§impl StrategyFactory
impl StrategyFactory
Sourcepub fn new() -> Self
pub fn new() -> Self
Create new strategy factory with default configurations Initializes templates optimized for different use cases
Sourcepub fn create_single_thread_strategy(
&self,
) -> Result<Box<dyn MemoryTracker>, TrackerError>
pub fn create_single_thread_strategy( &self, ) -> Result<Box<dyn MemoryTracker>, TrackerError>
Create single-thread strategy instance with optimized configuration Best for simple, sequential applications
Sourcepub fn create_thread_local_strategy(
&self,
) -> Result<Box<dyn MemoryTracker>, TrackerError>
pub fn create_thread_local_strategy( &self, ) -> Result<Box<dyn MemoryTracker>, TrackerError>
Create thread-local strategy instance for multi-threaded applications Optimized for applications with multiple worker threads
Sourcepub fn create_async_strategy(
&self,
) -> Result<Box<dyn MemoryTracker>, TrackerError>
pub fn create_async_strategy( &self, ) -> Result<Box<dyn MemoryTracker>, TrackerError>
Create async strategy instance for async/await applications Specialized for futures and task-based concurrency
Sourcepub fn create_hybrid_strategy(
&self,
) -> Result<Box<dyn MemoryTracker>, TrackerError>
pub fn create_hybrid_strategy( &self, ) -> Result<Box<dyn MemoryTracker>, TrackerError>
Create hybrid strategy instance for complex applications Handles mixed thread and async environments
Sourcepub fn record_performance(
&mut self,
strategy_name: &str,
performance: StrategyPerformance,
)
pub fn record_performance( &mut self, strategy_name: &str, performance: StrategyPerformance, )
Record strategy performance for future optimization Updates performance history with session metrics
Sourcepub fn get_performance_history(&self) -> &PerformanceHistory
pub fn get_performance_history(&self) -> &PerformanceHistory
Get performance history for analysis Provides read-only access to historical performance data
Sourcepub fn recommend_strategy(&self, requirements: &StrategyRequirements) -> String
pub fn recommend_strategy(&self, requirements: &StrategyRequirements) -> String
Recommend optimal strategy based on performance history Uses historical data to suggest best strategy for given requirements
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StrategyFactory
impl RefUnwindSafe for StrategyFactory
impl Send for StrategyFactory
impl Sync for StrategyFactory
impl Unpin for StrategyFactory
impl UnwindSafe for StrategyFactory
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
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>
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 more