pub struct DebounceMutex(/* private fields */);Expand description
An async Mutex type specialized for Perspective’s rendering, which
debounces calls in addition to providing exclusivity. Calling
Self::debounce resolves only after at least one complete evaluation
of a call that began no earlier than this one — either by running the
caller’s own future, or by coalescing onto the single parked trailing
runner. At most TWO debounce evaluations are ever outstanding (one
running, one parked); every additional concurrent caller resolves
without queueing on the lock.
Implementations§
Source§impl DebounceMutex
impl DebounceMutex
Sourcepub fn is_held(&self) -> bool
pub fn is_held(&self) -> bool
true while a locked task is executing. Used by lock-acquiring
public API methods to emit a debug-build warning when they are about
to queue behind an in-flight run — legitimate for app callers, a
guaranteed deadlock when reached synchronously from a plugin’s render
(the render-callable contract on js::plugin forbids it).
Sourcepub async fn lock_with<T, F, Fut>(&self, f: F) -> T
pub async fn lock_with<T, F, Fut>(&self, f: F) -> T
Lock, passing a RenderGuard witness into the task builder. The
task future is CONSTRUCTED after the lock is acquired — a guard can
never exist outside a locked section.
Sourcepub async fn debounce(
&self,
f: impl Future<Output = ApiResult<()>>,
) -> ApiResult<()>
pub async fn debounce( &self, f: impl Future<Output = ApiResult<()>>, ) -> ApiResult<()>
Lock and also debounce f, which should be cancellable.
Sourcepub async fn debounce_with<T, F, Fut>(&self, f: F) -> ApiResult<T>
pub async fn debounce_with<T, F, Fut>(&self, f: F) -> ApiResult<T>
Self::debounce with a RenderGuard witness (see
Trait Implementations§
Source§impl Clone for DebounceMutex
impl Clone for DebounceMutex
Source§fn clone(&self) -> DebounceMutex
fn clone(&self) -> DebounceMutex
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for DebounceMutex
impl Default for DebounceMutex
Source§fn default() -> DebounceMutex
fn default() -> DebounceMutex
Auto Trait Implementations§
impl !RefUnwindSafe for DebounceMutex
impl !Send for DebounceMutex
impl !Sync for DebounceMutex
impl !UnwindSafe for DebounceMutex
impl Freeze for DebounceMutex
impl Unpin for DebounceMutex
impl UnsafeUnpin for DebounceMutex
Blanket Implementations§
impl<Token, Builder, How> AllPropsFor<Builder, How> for Tokenwhere
Builder: Buildable<Token>,
<Builder as Buildable<Token>>::WrappedToken: HasAllProps<<Builder as Buildable<Token>>::Output, How>,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> HasAllProps<(), T> for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
Source§fn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
self to a value of a Properties struct.Source§impl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
Source§fn into_prop_value(self) -> T
fn into_prop_value(self) -> T
self to a value of a Properties struct.