Struct UiServiceRegistration

Source
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.

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats registration/tree IDs while deliberately omitting runtime state.

Source§

impl<A> Drop for UiServiceRegistration<A>

Unregisters the service if its runtime is still alive.

Source§

fn drop(&mut self)

Performs best-effort weak-runtime unregistration.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> ErasedDestructor for T
where T: 'static,