Skip to main content

Crate wgame_app

Crate wgame_app 

Source
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§

input
output
runtime
time
window

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.
LogicalSize
A size represented in logical pixels.
RawWindow
Represents a window.
Size
A size represented in physical pixels.
WindowAttributes
Attributes used when creating a window.
WindowTaskHandle
Clonable cancellation access without access to the result.
WindowedTask
Single-consumer window task. Dropping it detaches the task. Clone Self::handle for cancellation access. Cancellation before creation resolves without waiting for OS resume and prevents queued window creation. Suspension cancels the window function and reports WindowError::Suspended; a manually managed caller decides whether to recreate the window.

Enums§

Event
Describes an event from a [Window].
WindowError

Traits§

MainResult
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.