pub struct Registry<K, V> { /* private fields */ }
Expand description
It is similar to a map, but where the keys are stored at comptime, but the values can be runtime variables.
Implementations§
Source§impl<K: PartialOrd + Ord, V: CubeType + Clone> Registry<K, V>
impl<K: PartialOrd + Ord, V: CubeType + Clone> Registry<K, V>
Sourcepub fn __expand_new(_: &mut CubeContext) -> Registry<K, V::ExpandType>
pub fn __expand_new(_: &mut CubeContext) -> Registry<K, V::ExpandType>
Expand function of Self::new.
Sourcepub fn find<Query: RegistryQuery<K>>(&self, query: Query) -> V
pub fn find<Query: RegistryQuery<K>>(&self, query: Query) -> V
Find an item in the registry.
§Notes
If the item isn’t present in the registry, the function will panic.
Sourcepub fn insert<Query: RegistryQuery<K>>(&mut self, query: Query, value: V)
pub fn insert<Query: RegistryQuery<K>>(&mut self, query: Query, value: V)
Insert an item in the registry.
Sourcepub fn __expand_find<Query: RegistryQuery<K>>(
_context: &mut CubeContext,
state: Registry<K, V::ExpandType>,
key: Query,
) -> V::ExpandType
pub fn __expand_find<Query: RegistryQuery<K>>( _context: &mut CubeContext, state: Registry<K, V::ExpandType>, key: Query, ) -> V::ExpandType
Expand function of Self::find.
Sourcepub fn __expand_insert<Key: Into<K>>(
_context: &mut CubeContext,
state: Registry<K, V::ExpandType>,
key: Key,
value: V::ExpandType,
)
pub fn __expand_insert<Key: Into<K>>( _context: &mut CubeContext, state: Registry<K, V::ExpandType>, key: Key, value: V::ExpandType, )
Expand function of Self::insert.
Source§impl<K: PartialOrd + Ord, V: Clone> Registry<K, V>
impl<K: PartialOrd + Ord, V: Clone> Registry<K, V>
Sourcepub fn __expand_find_method(&self, _context: &mut CubeContext, key: K) -> V
pub fn __expand_find_method(&self, _context: &mut CubeContext, key: K) -> V
Expand method of Self::find.
Sourcepub fn __expand_insert_method(
self,
_context: &mut CubeContext,
key: K,
value: V,
)
pub fn __expand_insert_method( self, _context: &mut CubeContext, key: K, value: V, )
Expand method of Self::insert.
Trait Implementations§
Source§impl<K: PartialOrd + Ord, V: CubeType> CubeType for Registry<K, V>
impl<K: PartialOrd + Ord, V: CubeType> CubeType for Registry<K, V>
type ExpandType = Registry<K, <V as CubeType>::ExpandType>
Source§fn init(context: &mut CubeContext, expand: Self::ExpandType) -> Self::ExpandType
fn init(context: &mut CubeContext, expand: Self::ExpandType) -> Self::ExpandType
Wrapper around the init method, necessary to type inference.
Source§impl<K: PartialOrd + Ord, V: CubeType> IntoRuntime for Registry<K, V>
impl<K: PartialOrd + Ord, V: CubeType> IntoRuntime for Registry<K, V>
fn __expand_runtime_method( self, _context: &mut CubeContext, ) -> Registry<K, V::ExpandType>
Source§fn runtime(self) -> Self
fn runtime(self) -> Self
Make sure a type is actually expanded into its runtime expand type.
Auto Trait Implementations§
impl<K, V> Freeze for Registry<K, V>
impl<K, V> !RefUnwindSafe for Registry<K, V>
impl<K, V> !Send for Registry<K, V>
impl<K, V> !Sync for Registry<K, V>
impl<K, V> Unpin for Registry<K, V>
impl<K, V> !UnwindSafe for Registry<K, V>
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