Expand description
A catch all for project-wide macros and general-purpose functions that are not directly related to Perspective.
Modules below crate::utils strive to be single-responsibility, but some
reference other crate::utils modules when it helps reduce boiler-plate.
Structs§
- Debounce
Mutex - Debounce
Mutex Data - PubSub
- A pub/sub struct which allows many listeners to subscribe to many publishers, without leaking callbacks as listeners are dropped.
- PubSub
Internal - Status
Indicator Props - Subscriber
- Like a
PubSubwithoutPubSub::emit; the reciprocal ofPubSub::callback.Subscriberdoes not keep the parentPubSubalive. - Subscription
- Manages the lifetime of a listener registered to a
PubSub<T>by deregistering the associated listener when dropped. - Weak
Scope - A mutable reference for capturing the
Scope<_>props arguments, a useful function for tests.
Traits§
- AddListener
- AsBlob
- Caret
Position - Utilities for caret position. DOM elements have different APIs for this
but
Derefmakes them fall through, so it is important that this method be called on the correct struct type! - Custom
Element Metadata - ScopeT
Ext - Tee
- TeeInternal
- Trait for polymorphic return value via turbofish-const-generic syntax.
- ToFormatted
String
Functions§
- await_
dom_ loaded - An
asyncwhich awaits the browser’sloadevent, which is automatically bypassed ifdocument.readyStateindicates this has already occurred. - await_
queue_ microtask - An
asyncversion ofqueueMicrotask(), curiously absent fromweb_sys. - define_
web_ component - download
- posix_
to_ utc_ str - request_
animation_ frame - An
asyncversion ofrequestAnimationFrame(), which resolves on the next animation frame. - set_
timeout - An
asyncversion ofset_timeout, which resolves intimeoutmilliseconds - str_
to_ utc_ posix - use_
async_ callback - Just like
use_callback, except convenient for an async cresult body.