Expand description
Async (task, thread, timer) helper functions Timer and thread management for asynchronous operations.
This module provides:
TimerId/ThreadId: Unique identifiers for timers and background threadsInstant/Duration: Cross-platform time types (works on no_std with tick counters)ThreadReceiver: Channel for receiving messages from the main thread- Callback types for thread communication and system time queries
Structs§
- Check
Thread Finished Callback - Wrapper for thread completion check callback.
- GetSystem
Time Callback - Instant
Ptr - FFI-safe wrapper around std::time::Instant with custom clone/drop callbacks.
- Instant
PtrClone Callback - Instant
PtrDestructor Callback - Library
Send Thread MsgCallback - Wrapper for thread message send callback.
- System
Tick - Tick-based timestamp for systems without a real-time clock.
- System
Tick Diff - Represents a difference in ticks for systems that don’t support timing
- System
Time Diff - Duration represented as seconds + nanoseconds (mirrors std::time::Duration).
- Thread
Id - ID for uniquely identifying a background thread
- Thread
IdVec - Thread
Receiver - Channel endpoint for receiving messages from the main thread in a background thread.
- Thread
Receiver Destructor Callback - Wrapper for thread receiver destructor callback.
- Thread
Receiver Inner - Inner receiver state containing the actual channel and callbacks.
- Thread
Recv Callback - Wrapper for thread message receive callback.
- TimerId
- ID for uniquely identifying a timer
- Timer
IdVec
Enums§
- Duration
- A span of time, either from the system clock or as tick difference.
- Instant
- A point in time, either from the system clock or a tick counter.
- Option
Duration - Option
Instant - Option
Thread Id - Option
Thread Send Msg - Option
Timer Id - Terminate
Timer - Should a timer terminate or not - used to remove active timers
- Thread
IdVec Destructor - Thread
Send Msg - Message that can be sent from the main thread to the Thread using the ThreadId.
- Timer
IdVec Destructor
Constants§
- CURSOR_
BLINK_ TIMER_ ID - Timer ID for cursor blinking in contenteditable elements (~530ms interval)
- DOUBLE_
CLICK_ TIMER_ ID - Timer ID for double-click detection timeout
- DRAG_
AUTOSCROLL_ TIMER_ ID - Timer ID for auto-scroll during drag operations near edges
- SCROLL_
MOMENTUM_ TIMER_ ID - Timer ID for scroll momentum/inertia animation
- TOOLTIP_
DELAY_ TIMER_ ID - Timer ID for tooltip show delay
- USER_
TIMER_ ID_ START - First available ID for user-defined timers
Functions§
- get_
system_ time_ libstd - Default implementation that gets the current system time
Type Aliases§
- Check
Thread Finished Callback Type - Callback to check if a thread has finished execution.
- GetSystem
Time Callback Type - Get the current system type, equivalent to
std::time::Instant::now(), except it also works on systems that don’t have a clock (such as embedded timers) - Instant
PtrClone Callback Type - Instant
PtrDestructor Callback Type - Library
Send Thread MsgCallback Type - Callback to send a message to a background thread.
- Thread
IdVec Destructor Type - Thread
Receiver Destructor Callback Type - Callback to destroy a ThreadReceiver.
- Thread
Recv Callback Type - Callback for a running thread to receive messages from the main thread.
- Timer
IdVec Destructor Type