pub struct UiWakeSignal { /* private fields */ }Expand description
线程安全的跨线程黏性(latched)异步唤醒信号。
- 若在
UiWakeSignal::wait之前调用UiWakeSignal::wake,信号会被锁存,下一次wait().await立即就绪绝不丢唤醒; - 可通过
UiWakeSignal::notifier生成Fn() + Send + Sync + 'static直接注入crate::engine::VeloxEngine::set_async_waker。
Implementations§
Source§impl UiWakeSignal
impl UiWakeSignal
Sourcepub fn notifier(&self) -> impl Fn() + Send + Sync + 'static
pub fn notifier(&self) -> impl Fn() + Send + Sync + 'static
构造一个可直接传给 crate::engine::VeloxEngine::set_async_waker 的线程安全唤醒闭包。
Sourcepub fn wait(&self) -> UiWakeFuture ⓘ
pub fn wait(&self) -> UiWakeFuture ⓘ
异步挂起等待下一次唤醒信号(消费已锁存信号后立刻返回)。
Trait Implementations§
Source§impl Clone for UiWakeSignal
impl Clone for UiWakeSignal
Auto Trait Implementations§
impl Forget for UiWakeSignal
impl Freeze for UiWakeSignal
impl Move for UiWakeSignal
impl RefUnwindSafe for UiWakeSignal
impl Send for UiWakeSignal
impl Sync for UiWakeSignal
impl Unpin for UiWakeSignal
impl UnsafeUnpin for UiWakeSignal
impl UnwindSafe for UiWakeSignal
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FluentBuilder for T
impl<T> FluentBuilder for T
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
当
condition 为 true 时执行闭包修饰自身,否则原样返回。Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Self
fn when_else( self, condition: bool, then: impl FnOnce(Self) -> Self, else_fn: impl FnOnce(Self) -> Self, ) -> Self
根据
condition 在两个修饰分支之间二选一。Source§fn when_some<O>(
self,
option: Option<O>,
then: impl FnOnce(Self, O) -> Self,
) -> Self
fn when_some<O>( self, option: Option<O>, then: impl FnOnce(Self, O) -> Self, ) -> Self
当
option 为 Some(value) 时执行闭包修饰自身,否则原样返回。