Skip to main content

BoxContext

Type Alias BoxContext 

Source
pub type BoxContext = SmallBox<dyn Context, S4>;
Expand description

Boxed context trait object using SmallBox for inline storage.

Uses SmallBox with S4 space (4 * usize = 32 bytes on 64-bit) to avoid heap allocation for small contexts (like CacheContext). Larger contexts (like CompositionContext) fall back to heap allocation automatically.

This optimization reduces allocation overhead in the common case where only basic cache context tracking is needed.

Aliased Typeยง

pub struct BoxContext { /* private fields */ }