Skip to main content

Module task

Module task 

Source
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 threads
  • Instant / 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§

CheckThreadFinishedCallback
Wrapper for thread completion check callback.
GetSystemTimeCallback
InstantPtr
FFI-safe wrapper around std::time::Instant with custom clone/drop callbacks.
InstantPtrCloneCallback
InstantPtrDestructorCallback
LibrarySendThreadMsgCallback
Wrapper for thread message send callback.
SystemTick
Tick-based timestamp for systems without a real-time clock.
SystemTickDiff
Represents a difference in ticks for systems that don’t support timing
SystemTimeDiff
Duration represented as seconds + nanoseconds (mirrors std::time::Duration).
ThreadId
ID for uniquely identifying a background thread
ThreadIdVec
ThreadReceiver
Channel endpoint for receiving messages from the main thread in a background thread.
ThreadReceiverDestructorCallback
Wrapper for thread receiver destructor callback.
ThreadReceiverInner
Inner receiver state containing the actual channel and callbacks.
ThreadRecvCallback
Wrapper for thread message receive callback.
TimerId
ID for uniquely identifying a timer
TimerIdVec

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.
OptionDuration
OptionInstant
OptionThreadId
OptionThreadSendMsg
OptionTimerId
TerminateTimer
Should a timer terminate or not - used to remove active timers
ThreadIdVecDestructor
ThreadSendMsg
Message that can be sent from the main thread to the Thread using the ThreadId.
TimerIdVecDestructor

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§

CheckThreadFinishedCallbackType
Callback to check if a thread has finished execution.
GetSystemTimeCallbackType
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)
InstantPtrCloneCallbackType
InstantPtrDestructorCallbackType
LibrarySendThreadMsgCallbackType
Callback to send a message to a background thread.
ThreadIdVecDestructorType
ThreadReceiverDestructorCallbackType
Callback to destroy a ThreadReceiver.
ThreadRecvCallbackType
Callback for a running thread to receive messages from the main thread.
TimerIdVecDestructorType