pub struct CompileCache { /* private fields */ }Implementations§
Source§impl CompileCache
impl CompileCache
pub fn new(device: Device, capacity: usize) -> Self
Sourcepub fn with_policy(
device: Device,
capacity: usize,
policy: Option<PrecisionPolicy>,
) -> Self
pub fn with_policy( device: Device, capacity: usize, policy: Option<PrecisionPolicy>, ) -> Self
Cache that compiles every entry with the given precision policy.
Use this when the cached entries should differ from CPU-default
F32 — e.g., PrecisionPolicy::AutoMixed for f16 compute on Metal.
Sourcepub fn get_or_compile<F: FnOnce() -> Graph>(
&mut self,
key: u64,
build: F,
) -> &mut CompiledGraph
pub fn get_or_compile<F: FnOnce() -> Graph>( &mut self, key: u64, build: F, ) -> &mut CompiledGraph
Compile if not present, then return a mutable reference. The borrow
lifetime is tied to &mut self so callers naturally serialize their
use of any one entry — the cache is single-owner today.
Sourcepub fn get_or_compile_with_options<F: FnOnce() -> Graph>(
&mut self,
key: u64,
build: F,
options: &CompileOptions,
) -> &mut CompiledGraph
pub fn get_or_compile_with_options<F: FnOnce() -> Graph>( &mut self, key: u64, build: F, options: &CompileOptions, ) -> &mut CompiledGraph
Like Self::get_or_compile with explicit [CompileOptions].
pub fn is_empty(&self) -> bool
Auto Trait Implementations§
impl Freeze for CompileCache
impl !RefUnwindSafe for CompileCache
impl Send for CompileCache
impl !Sync for CompileCache
impl Unpin for CompileCache
impl UnsafeUnpin for CompileCache
impl !UnwindSafe for CompileCache
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