pub struct UiServiceRegistration<A> { /* private fields */ }Expand description
RAII lifetime for one UI-thread background-service registration.
Dropping the guard unregisters its tree-scoped weak callback when the runtime still exists. Keeping the guard alone does not keep either the callback or runtime alive.
§Examples
use std::rc::Rc;
use ailloli_ui_runtime::app::RuntimeHandle;
let runtime = RuntimeHandle::<()>::new();
let callback: Rc<dyn Fn() -> bool> = Rc::new(|| true);
let registration = runtime.register_ui_service(&callback);
assert!(format!("{registration:?}").contains("UiServiceRegistration"));Trait Implementations§
Source§impl<A> Debug for UiServiceRegistration<A>
Omits callback/runtime internals while exposing diagnostic IDs.
impl<A> Debug for UiServiceRegistration<A>
Omits callback/runtime internals while exposing diagnostic IDs.
Auto Trait Implementations§
impl<A> Freeze for UiServiceRegistration<A>
impl<A> !RefUnwindSafe for UiServiceRegistration<A>
impl<A> !Send for UiServiceRegistration<A>
impl<A> !Sync for UiServiceRegistration<A>
impl<A> Unpin for UiServiceRegistration<A>
impl<A> !UnwindSafe for UiServiceRegistration<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