pub struct MusicComponentRegistry { /* private fields */ }Expand description
An ordered collection of music components keyed by qualified id.
Entries are stored in a BTreeMap so iteration order is deterministic.
Implementations§
Source§impl MusicComponentRegistry
impl MusicComponentRegistry
Sourcepub fn register(&mut self, entry: MusicComponentRegistryEntry) -> Result<()>
pub fn register(&mut self, entry: MusicComponentRegistryEntry) -> Result<()>
Registers an entry, failing if its id is already present.
Sourcepub fn get(&self, id: &Symbol) -> Option<&MusicComponentRegistryEntry>
pub fn get(&self, id: &Symbol) -> Option<&MusicComponentRegistryEntry>
Looks up an entry by its qualified id, if registered.
Sourcepub fn entries(&self) -> impl Iterator<Item = &MusicComponentRegistryEntry>
pub fn entries(&self) -> impl Iterator<Item = &MusicComponentRegistryEntry>
Iterates over all registered entries in id order.
Sourcepub fn by_capability(
&self,
capability: MusicCapability,
) -> Vec<&MusicComponentRegistryEntry>
pub fn by_capability( &self, capability: MusicCapability, ) -> Vec<&MusicComponentRegistryEntry>
Collects every entry that declares the given capability.
Sourcepub fn require_capability(
&self,
id: &Symbol,
capability: MusicCapability,
) -> Result<&MusicComponentRegistryEntry>
pub fn require_capability( &self, id: &Symbol, capability: MusicCapability, ) -> Result<&MusicComponentRegistryEntry>
Looks up an entry and requires it to declare the given capability.
Returns an error if the id is not registered or the component lacks the capability.
Sourcepub fn inventory_expr(&self) -> Expr
pub fn inventory_expr(&self) -> Expr
Encodes the full registry as a tagged inventory Expr map.
Trait Implementations§
Source§impl Clone for MusicComponentRegistry
impl Clone for MusicComponentRegistry
Source§fn clone(&self) -> MusicComponentRegistry
fn clone(&self) -> MusicComponentRegistry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MusicComponentRegistry
impl Debug for MusicComponentRegistry
Source§impl Default for MusicComponentRegistry
impl Default for MusicComponentRegistry
Source§fn default() -> MusicComponentRegistry
fn default() -> MusicComponentRegistry
Returns the “default value” for a type. Read more
impl Eq for MusicComponentRegistry
Source§impl PartialEq for MusicComponentRegistry
impl PartialEq for MusicComponentRegistry
impl StructuralPartialEq for MusicComponentRegistry
Auto Trait Implementations§
impl Freeze for MusicComponentRegistry
impl RefUnwindSafe for MusicComponentRegistry
impl Send for MusicComponentRegistry
impl Sync for MusicComponentRegistry
impl Unpin for MusicComponentRegistry
impl UnsafeUnpin for MusicComponentRegistry
impl UnwindSafe for MusicComponentRegistry
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