Crate zng_app

Crate zng_app 

Source
Expand description

App process implementation.

§Widget Instantiation

See enable_widget_macros! if you want to instantiate widgets without depending on the zng crate.

§Crate

This crate is part of the zng project.

§Cargo Features

This crate provides 11 feature flags, 0 enabled by default.

§"inspector"

Instrument each widget instance to retain build information.

§"dyn_app_extension"

Use dynamic dispatch at the app-extension level.

This speeds-up compilation time at the cost of runtime.

§"test_util"

Like cfg(test) but also visible in docs and integration tests.

§"multi_app"

Allows multiple app instances per-process.

This feature allows multiple apps, one app per thread at a time. The LocalContext tracks what app is currently running in each thread and app_local! statics switch to the value of each app depending on the current thread.

Not enabled by default, but enabled by feature="test_util".

§"trace_widget"

Instrument every widget outer-most node to trace UI methods.

§"trace_wgt_item"

Instrument every property and intrinsic node to trace UI methods.

Note that this can cause very large trace files and bad performance.

§"crash_handler"

Allow app-process crash handler.

Only enables in not(any(target_arch = "wasm32", target_os = "android", target_os = "ios")) builds.

§"trace_recorder"

Enable trace recording.

Note that this does not auto start recording, to do that run with the "ZNG_RECORD_TRACE" env var set.

See zng::app::trace_recorder for more details.

§"ipc"

Enables IPC tasks and pre-build views and connecting to views running in another process.

§"deadlock_detection"

Spawns a thread on app creation that checks and prints parking_lot deadlocks.

Not enabled by default, but enabled by feature="test_util".

See zng::app::spawn_deadlock_detection for more details.

§"memory_profiler"

Enable instrumented allocator and record allocations.

Note that this replaces the #[global_allocator] and has an impact in performance.

See zng::app::memory_profiler for more details.

Modules§

access
Accessibility/automation events.
crash_handler
App-process crash handler.
event
App event and commands API.
handler
Handler types and macros.
render
Frame render and metadata API.
shortcut
Key combination types.
third_party
Third party licenses service and types.
timer
App timers, deadlines and timeouts.
trace_recorder
Trace recording and data model.
update
App updates API.
view_process
View process connection and other types.
widget
Widget, UI node API.
window
Window context API.

Macros§

async_hn
Declare an async clone-move event handler.
async_hn_once
Declare an async clone-move event handler that is only called once.
command
Declares new Command static items.
crash_handler_config
Register a FnOnce(&mut CrashConfig) closure to be called on process init to configure the crash handler.
enable_widget_macros
Enable widget instantiation in crates that can’t depend on the zng crate.
event_args
Declares new EventArgs types.
event_macro
Declares new Event<A> static items.
hn
Declare a mutable clone-move event handler.
hn_once
Declare a clone-move event handler that is only called once.
property_args
New Box<PropertyArgs> box from a property and value.
property_id
New PropertyId that represents the type and name.
property_info
New PropertyInfo from property path.
property_input_types
Gets the strong input storage types from a property path.
shortcut_macro
Creates a Shortcut.
source_location
New SourceLocation that represents the location you call this macro.
static_id
Declares a static unique ID that is lazy inited.
ui_vec
Creates an UiVec containing the arguments.
widget_impl
Implement a property on the widget to strongly associate it with the widget.
widget_set
Sets properties and when condition on a widget builder.
widget_type
Gets the WidgetType info of a widget.

Structs§

APP
Start and manage an app process.
AppEventSender
A sender that can awake apps and insert events into the main loop.
AppExtended
Application builder.
AppExtensionInfo
Info about an app-extension.
AppExtensionsInfo
List of app-extensions that are part of an app.
AppStartArgs
Arguments for on_app_start handlers.
DInstant
Duration elapsed since an epoch.
Deadline
Represents a timeout instant.
ExitCancelled
Cancellation message of an exit request.
ExitRequestedArgs
Arguments for EXIT_REQUESTED_EVENT.
HeadlessApp
A headless app controller.
INSTANT
Instant service.

Enums§

AppControlFlow
Desired next step of app main loop.
InstantMode
Defines how the INSTANT.now value updates in the app.

Statics§

EXIT_CMD
Represents the app process exit request.
EXIT_REQUESTED_EVENT
Cancellable event raised when app process exit is requested.

Traits§

AppEventObserver
Observer for HeadlessApp::update_observed.
AppExtension
An app extension.

Functions§

on_app_start
Register a handler to run when an APP starts running in the process.
print_tracing
Enables tracing events printing if a subscriber is not already set.
print_tracing_filter
Filter used by print_tracing, removes some log noise from dependencies.
spawn_deadlock_detection
When compiled with "deadlock_detection" spawns a thread that monitors for parking_lot deadlocks.
test_log
Modifies the print_tracing subscriber to panic for error logs in the current app.