pub struct ListenerLocalBuilder<'a> { /* private fields */ }Expand description
A builder for registering registry event callbacks.
Use Registry::add_listener_local to create this and register callbacks that will be called when events of interest occur.
After adding callbacks, use register to get back a
registry::Listener.
§Examples
let registry_listener = registry.add_listener_local()
.global(|global| println!("New global: {global:?}"))
.global_remove(|id| println!("Global with id {id} was removed"))
.register();Implementations§
Source§impl<'a> ListenerLocalBuilder<'a>
impl<'a> ListenerLocalBuilder<'a>
Sourcepub fn global_remove<F>(self, global_remove: F) -> Self
pub fn global_remove<F>(self, global_remove: F) -> Self
Set the registry global_remove event callback of the listener.
This event is emitted when a global object was removed from the registry. If the client has any bindings to the global, it should destroy those.
§Callback parameters
id: The id of the global that was removed
§Examples
let registry_listener = registry.add_listener_local()
.global_remove(|id| println!("Global with id {id} was removed"))
.register();Auto Trait Implementations§
impl<'a> Freeze for ListenerLocalBuilder<'a>
impl<'a> !RefUnwindSafe for ListenerLocalBuilder<'a>
impl<'a> !Send for ListenerLocalBuilder<'a>
impl<'a> !Sync for ListenerLocalBuilder<'a>
impl<'a> Unpin for ListenerLocalBuilder<'a>
impl<'a> !UnwindSafe for ListenerLocalBuilder<'a>
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