pub struct SampleContext { /* private fields */ }Expand description
Context for memoizing samples within a single evaluation to ensure shared variables produce the same sample value throughout an evaluation
Implementations§
Source§impl SampleContext
impl SampleContext
Sourcepub fn with_caching_strategy(strategy: CachingStrategy) -> Self
pub fn with_caching_strategy(strategy: CachingStrategy) -> Self
Create a sample context with specific caching strategy
Sourcepub fn get_value<T: Clone + 'static>(&self, id: &Uuid) -> Option<T>
pub fn get_value<T: Clone + 'static>(&self, id: &Uuid) -> Option<T>
Get a memoized value for a given node ID
Sourcepub fn set_value<T: Clone + Send + 'static>(&mut self, id: Uuid, value: T)
pub fn set_value<T: Clone + Send + 'static>(&mut self, id: Uuid, value: T)
Set a memoized value for a given node ID
Sourcepub fn should_cache_node(&self, node: &ComputationNode<impl Shareable>) -> bool
pub fn should_cache_node(&self, node: &ComputationNode<impl Shareable>) -> bool
Determine if a node should be cached based on strategy and cost
Sourcepub fn adaptive_sampling(&self) -> &AdaptiveSampling
pub fn adaptive_sampling(&self) -> &AdaptiveSampling
Get the adaptive sampling configuration
Sourcepub fn set_adaptive_sampling(&mut self, config: AdaptiveSampling)
pub fn set_adaptive_sampling(&mut self, config: AdaptiveSampling)
Set adaptive sampling configuration
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for SampleContext
impl !Sync for SampleContext
impl !UnwindSafe for SampleContext
impl Freeze for SampleContext
impl Send for SampleContext
impl Unpin for SampleContext
impl UnsafeUnpin for SampleContext
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