Struct pipewire_wrapper::listeners::Listeners
source · pub struct Listeners<T> { /* private fields */ }
Expand description
Owned listeners storage. Each listener associated with constant ListenerId. Can be cloned between threads.
Implementations§
source§impl<T> Listeners<T>
impl<T> Listeners<T>
sourcepub fn add(&self, listener: T) -> ListenerId
pub fn add(&self, listener: T) -> ListenerId
Add new listener to the storage.
Arguments
listener
- new listener
Returns ListenerId associated with the given listener in this storage.
sourcepub fn remove(&self, id: ListenerId) -> Option<T>
pub fn remove(&self, id: ListenerId) -> Option<T>
Remove listener by ListenerId.
Arguments
id
- ListenerId
Returns the listener or None
Notes
The listener will be unsubscribed after drop.
sourcepub fn contains(&self, id: ListenerId) -> bool
pub fn contains(&self, id: ListenerId) -> bool
Whether the storage contains listener with the given id.
Trait Implementations§
Auto Trait Implementations§
impl<T> RefUnwindSafe for Listeners<T>
impl<T> Send for Listeners<T>where T: Send,
impl<T> Sync for Listeners<T>where T: Send,
impl<T> Unpin for Listeners<T>
impl<T> UnwindSafe for Listeners<T>
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