Expand description
A cooperative event-loop runtime for windows, tasks, and timers.
Work runs on the event-loop thread: blocking CPU work also blocks input and
rendering. Awaiting file I/O or timers yields control. A Runtime handle is
local to this thread.
Expired timers schedule another task poll even when there are no window or
input events; idle applications can use timers without continuous redraws.
spawn creates a single-consumer Task. Use Task::handle for shared
cancellation and Task::cancel_on_drop for work owned by a window or scope.
WindowedTask similarly separates its result from its cancellation handle.
See those types for cancellation and suspension behavior.
Native builds require an appropriate backend (x11/wayland on Linux, std on
Windows/macOS). Native and web runtime features cannot be enabled together.
Re-exports§
pub use crate::app::App;pub use crate::runtime::Runtime;pub use crate::runtime::ScopedTask;pub use crate::runtime::Task;pub use crate::runtime::TaskHandle;pub use crate::runtime::sleep;pub use crate::runtime::spawn;pub use crate::window::Window;pub use crate::windowed_task::WindowError;pub use crate::windowed_task::WindowTaskHandle;pub use crate::windowed_task::WindowedTask;pub use crate::windowed_task::create_windowed_task;
Modules§
Macros§
- app_
main - Macro to generate a main function for an application.
- window_
main - Macro to generate a main function for a windowed application.
Structs§
- App
- Input
- An independent buffered stream of window events.
- Logical
Size - A size represented in logical pixels.
- RawWindow
- Represents a window.
- Size
- A size represented in physical pixels.
- Window
Attributes - Attributes used when creating a window.
- Window
Task Handle - Clonable cancellation access without access to the result.
- Windowed
Task - Single-consumer window task. Dropping it detaches the task.
Clone
Self::handlefor cancellation access. Cancellation before creation resolves without waiting for OS resume and prevents queued window creation. Suspension cancels the window function and reportsWindowError::Suspended; a manually managed caller decides whether to recreate the window.
Enums§
- Event
- Describes an event from a [
Window]. - Window
Error
Traits§
- Main
Result - Trait for main function return types.
Functions§
- app_
with_ single_ window - Runs an application with a single window.
- create_
windowed_ task - entry
- Entry point for standard library builds.
- run_app
- Runs an application with the given async function.