pub struct ProcStore(/* private fields */);Expand description
A type-erased store accessible to all AudioNodeProcessors.
Implementations§
Source§impl ProcStore
impl ProcStore
pub fn with_capacity(capacity: usize) -> Self
Sourcepub fn insert<S: Send + 'static>(&mut self, resource: S) -> Result<(), S>
pub fn insert<S: Send + 'static>(&mut self, resource: S) -> Result<(), S>
Insert a new resource into the store.
If a resource with this TypeID already exists, then an error will
be returned instead.
Sourcepub fn insert_any<S: Send + 'static>(
&mut self,
resource: Box<dyn Any + Send>,
type_id: TypeId,
) -> Result<(), Box<dyn Any + Send>>
pub fn insert_any<S: Send + 'static>( &mut self, resource: Box<dyn Any + Send>, type_id: TypeId, ) -> Result<(), Box<dyn Any + Send>>
Insert a new already type-erased resource into the store.
If a resource with this TypeID already exists, then an error will
be returned instead.
Sourcepub fn entry<'a, S: Send + 'static>(&'a mut self) -> ProcStoreEntry<'a, S>
pub fn entry<'a, S: Send + 'static>(&'a mut self) -> ProcStoreEntry<'a, S>
Get the entry for the given resource.
Sourcepub fn contains<S: Send + 'static>(&self) -> bool
pub fn contains<S: Send + 'static>(&self) -> bool
Returns true if a resource with the given TypeID exists in this
store.
Sourcepub fn get<S: Send + 'static>(&self) -> &S
pub fn get<S: Send + 'static>(&self) -> &S
Get an immutable reference to a resource in the store.
§Panics
Panics if the given resource does not exist.
Sourcepub fn get_mut<S: Send + 'static>(&mut self) -> &mut S
pub fn get_mut<S: Send + 'static>(&mut self) -> &mut S
Get a mutable reference to a resource in the store.
§Panics
Panics if the given resource does not exist.
Sourcepub fn try_get<S: Send + 'static>(&self) -> Option<&S>
pub fn try_get<S: Send + 'static>(&self) -> Option<&S>
Get an immutable reference to a resource in the store.
Returns None if the given resource does not exist.
Sourcepub fn try_get_mut<S: Send + 'static>(&mut self) -> Option<&mut S>
pub fn try_get_mut<S: Send + 'static>(&mut self) -> Option<&mut S>
Get a mutable reference to a resource in the store.
Returns None if the given resource does not exist.
Auto Trait Implementations§
impl Freeze for ProcStore
impl !RefUnwindSafe for ProcStore
impl Send for ProcStore
impl !Sync for ProcStore
impl Unpin for ProcStore
impl !UnwindSafe for ProcStore
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.