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 + Debug, V: CubeType<ExpandType: Clone> + Clone> Registry<K, V>
impl<K: PartialOrd + Ord + Debug, V: CubeType<ExpandType: Clone> + Clone> Registry<K, V>
Sourcepub fn __expand_new(_: &Scope) -> Registry<K, V::ExpandType>
pub fn __expand_new(_: &Scope) -> 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 find_or_default<Query: RegistryQuery<K>>(&mut self, query: Query) -> V
pub fn find_or_default<Query: RegistryQuery<K>>(&mut self, query: Query) -> V
Find an item in the registry or return the default value.
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>>(
_scope: &Scope,
state: Registry<K, V::ExpandType>,
key: Query,
) -> V::ExpandType
pub fn __expand_find<Query: RegistryQuery<K>>( _scope: &Scope, state: Registry<K, V::ExpandType>, key: Query, ) -> V::ExpandType
Expand function of Self::find.
Sourcepub fn __expand_find_or_default<Query: RegistryQuery<K>>(
_scope: &Scope,
state: &mut Registry<K, V::ExpandType>,
key: Query,
) -> V::ExpandType
pub fn __expand_find_or_default<Query: RegistryQuery<K>>( _scope: &Scope, state: &mut Registry<K, V::ExpandType>, key: Query, ) -> V::ExpandType
Expand function of Self::find_or_default.
Sourcepub fn __expand_insert<Key: Into<K>>(
_scope: &Scope,
state: &mut Registry<K, V::ExpandType>,
key: Key,
value: V::ExpandType,
)
pub fn __expand_insert<Key: Into<K>>( _scope: &Scope, state: &mut Registry<K, V::ExpandType>, key: Key, value: V::ExpandType, )
Expand function of Self::insert.
Source§impl<K: PartialOrd + Ord + Debug, V: Clone> Registry<K, V>
impl<K: PartialOrd + Ord + Debug, V: Clone> Registry<K, V>
Sourcepub fn __expand_find_method(&self, _scope: &Scope, key: K) -> V
pub fn __expand_find_method(&self, _scope: &Scope, key: K) -> V
Expand method of Self::find.
Sourcepub fn __expand_insert_method(&mut self, _scope: &Scope, key: K, value: V)
pub fn __expand_insert_method(&mut self, _scope: &Scope, key: K, value: V)
Expand method of Self::insert.
Trait Implementations§
Source§impl<K, V> AsMutExpand for Registry<K, V>
impl<K, V> AsMutExpand for Registry<K, V>
fn __expand_ref_mut_method(&mut self, _: &Scope) -> &mut Self
fn __expand_as_mut_method(&mut self, scope: &Scope) -> &mut T
Source§impl<K, V> AsRefExpand for Registry<K, V>
impl<K, V> AsRefExpand for Registry<K, V>
fn __expand_ref_method(&self, _: &Scope) -> &Self
fn __expand_as_ref_method(&self, scope: &Scope) -> &T
Source§impl<K: PartialOrd + Ord, V> CubeDebug for Registry<K, V>
impl<K: PartialOrd + Ord, V> CubeDebug for Registry<K, V>
Source§fn set_debug_name(&self, scope: &Scope, name: &'static str)
fn set_debug_name(&self, scope: &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: PartialOrd + Ord, V: CubeType<ExpandType: Clone>> CubeType for Registry<K, V>
impl<K: PartialOrd + Ord, V: CubeType<ExpandType: Clone>> CubeType for Registry<K, V>
type ExpandType = Registry<K, <V as CubeType>::ExpandType>
Source§impl<K, V> ExpandTypeClone for Registry<K, V>
impl<K, V> ExpandTypeClone for Registry<K, V>
Source§fn clone_unchecked(&self) -> Self
fn clone_unchecked(&self) -> Self
Unchecked clone that only clones the conceptual runtime value. Should only be used in cases
where each copy is used in a mutually exclusive branch (i.e. match, runtime enums). This is
intentionally separated from Rust’s
Clone semantics and should only be used for the
conceptual expand values, never real data. Using two values in the same branch is undefined
behaviour.Source§impl<K, V> IntoExpand for Registry<K, V>
impl<K, V> IntoExpand for Registry<K, V>
Auto Trait Implementations§
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> !UnwindSafe for Registry<K, V>
impl<K, V> Freeze for Registry<K, V>
impl<K, V> Unpin for Registry<K, V>
impl<K, V> UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneExpand for Twhere
T: Clone,
impl<T> CloneExpand for Twhere
T: Clone,
fn __expand_clone_method(&self, _: &Scope) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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