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, V> Registry<K, V>
impl<K, V> Registry<K, V>
Sourcepub fn __expand_new(_: &mut Scope) -> Registry<K, <V as CubeType>::ExpandType>
pub fn __expand_new(_: &mut Scope) -> Registry<K, <V as CubeType>::ExpandType>
Expand function of Self::new.
Sourcepub fn find<Query>(&self, query: Query) -> Vwhere
Query: RegistryQuery<K>,
pub fn find<Query>(&self, query: Query) -> Vwhere
Query: RegistryQuery<K>,
Find an item in the registry.
§Notes
If the item isn’t present in the registry, the function will panic.
Sourcepub fn find_or_default<Query>(&mut self, query: Query) -> V
pub fn find_or_default<Query>(&mut self, query: Query) -> V
Find an item in the registry or return the default value.
Sourcepub fn insert<Query>(&mut self, query: Query, value: V)where
Query: RegistryQuery<K>,
pub fn insert<Query>(&mut self, query: Query, value: V)where
Query: RegistryQuery<K>,
Insert an item in the registry.
Sourcepub fn __expand_find<Query>(
_scope: &mut Scope,
state: Registry<K, <V as CubeType>::ExpandType>,
key: Query,
) -> <V as CubeType>::ExpandTypewhere
Query: RegistryQuery<K>,
pub fn __expand_find<Query>(
_scope: &mut Scope,
state: Registry<K, <V as CubeType>::ExpandType>,
key: Query,
) -> <V as CubeType>::ExpandTypewhere
Query: RegistryQuery<K>,
Expand function of Self::find.
Sourcepub fn __expand_find_or_default<Query>(
_scope: &mut Scope,
state: Registry<K, <V as CubeType>::ExpandType>,
key: Query,
) -> <V as CubeType>::ExpandType
pub fn __expand_find_or_default<Query>( _scope: &mut Scope, state: Registry<K, <V as CubeType>::ExpandType>, key: Query, ) -> <V as CubeType>::ExpandType
Expand function of Self::find_or_default.
Sourcepub fn __expand_insert<Key>(
_scope: &mut Scope,
state: Registry<K, <V as CubeType>::ExpandType>,
key: Key,
value: <V as CubeType>::ExpandType,
)where
Key: Into<K>,
pub fn __expand_insert<Key>(
_scope: &mut Scope,
state: Registry<K, <V as CubeType>::ExpandType>,
key: Key,
value: <V as CubeType>::ExpandType,
)where
Key: Into<K>,
Expand function of Self::insert.
Source§impl<K, V> Registry<K, V>
impl<K, V> Registry<K, V>
Sourcepub fn __expand_find_method(&self, _scope: &mut Scope, key: K) -> V
pub fn __expand_find_method(&self, _scope: &mut Scope, key: K) -> V
Expand method of Self::find.
Sourcepub fn __expand_insert_method(self, _scope: &mut Scope, key: K, value: V)
pub fn __expand_insert_method(self, _scope: &mut Scope, key: K, value: V)
Expand method of Self::insert.
Trait Implementations§
Source§impl<K, V> CubeDebug for Registry<K, V>where
K: PartialOrd + Ord,
impl<K, V> CubeDebug for Registry<K, V>where
K: PartialOrd + Ord,
Source§fn set_debug_name(&self, scope: &mut Scope, name: &'static str)
fn set_debug_name(&self, scope: &mut Scope, name: &'static str)
Set the debug name of this type’s expansion. Should do nothing for types that don’t appear
at runtime
Source§impl<K, V> CubeType for Registry<K, V>
impl<K, V> CubeType for Registry<K, V>
type ExpandType = Registry<K, <V as CubeType>::ExpandType>
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> UnsafeUnpin 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