Trait UiWake

Source
pub trait UiWake:
    Send
    + Sync
    + 'static {
    // Required method
    fn wake(&self) -> Result<(), UiWakeError>;
}
Expand description

Narrow thread-safe callback used to wake the UI host.

Implementations should return quickly and must be callable concurrently. A successful wake means only that the host was signaled; mailbox draining remains the host’s responsibility.

§Examples

use ailloli_ui_runtime::app::{UiWake, UiWakeError};
struct Wake;
impl UiWake for Wake { fn wake(&self) -> Result<(), UiWakeError> { Ok(()) } }
assert!(Wake.wake().is_ok());

Required Methods§

Source

fn wake(&self) -> Result<(), UiWakeError>

Signals the UI host or reports a closed/transient target.

§Errors

Returns UiWakeError::TargetClosed when the target cannot accept any future wake, or UiWakeError::TemporarilyUnavailable when retrying may succeed.

§Examples
use ailloli_ui_runtime::app::{UiWake, UiWakeError};
struct Closed;
impl UiWake for Closed { fn wake(&self) -> Result<(), UiWakeError> { Err(UiWakeError::TargetClosed) } }
assert_eq!(Closed.wake(), Err(UiWakeError::TargetClosed));

Implementors§