pub struct KeyedKernels<K> { /* private fields */ }Expand description
A caller-key index over HRX’s artifact-keyed loaded kernels.
Create with Kernels::keyed. A hit checks device ownership and returns a
shared executable without hashing source, serializing a specialization or
invoking the request factory. The index stores artifact identities, not a
second collection of executables.
Implementations§
Source§impl<K: Eq + Hash> KeyedKernels<K>
impl<K: Eq + Hash> KeyedKernels<K>
Sourcepub unsafe fn request_or_insert_with<S: AsRef<str>>(
&self,
stream: &Stream,
key: K,
request: impl FnOnce(&K) -> Result<(S, Specialization)>,
) -> Result<Pending>
pub unsafe fn request_or_insert_with<S: AsRef<str>>( &self, stream: &Stream, key: K, request: impl FnOnce(&K) -> Result<(S, Specialization)>, ) -> Result<Pending>
Index a pending request without compiling. Hits do not call the factory or hash source. Failed compilation remains queued for a later retry. The factory must not reenter this index.
§Safety
Equal keys must describe the same source and specialization. Loading is
still governed by Pending::resolve’s trusted-code contract.
Sourcepub unsafe fn get_or_insert_with<'s>(
&self,
stream: &Stream,
key: K,
request: impl FnOnce(&K) -> Result<(&'s str, Specialization)>,
) -> Result<Kernel>
pub unsafe fn get_or_insert_with<'s>( &self, stream: &Stream, key: K, request: impl FnOnce(&K) -> Result<(&'s str, Specialization)>, ) -> Result<Kernel>
Return the kernel named by key, constructing its request only on a miss.
Failed requests are not indexed and can be retried. The factory is run under the index lock; it and the reporting callback must not reenter this index. The underlying cache’s device restriction applies to hits too.
§Safety
As Kernels::get. Equal keys must always describe the same source and
specialization, including compiler-report settings. The factory is not
evaluated on a hit, so changing it does not change a cached kernel.
Auto Trait Implementations§
impl<K> !Freeze for KeyedKernels<K>
impl<K> RefUnwindSafe for KeyedKernels<K>
impl<K> Send for KeyedKernels<K>
impl<K> Sync for KeyedKernels<K>
impl<K> Unpin for KeyedKernels<K>
impl<K> UnsafeUnpin for KeyedKernels<K>
impl<K> UnwindSafe for KeyedKernels<K>
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> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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