Crate zng_env

Crate zng_env 

Source
Expand description

Process environment directories and unique name.

§Crate

This crate is part of the zng project.

§Cargo Features

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

§"built_res"

Check if res path is available in init_built_res first.

Enabled by default in debug builds, ignored in Android and Wasm.

§"parse"

Enable manifest metadata parsing.

Macros§

init
Inits process metadata, calls process start handlers and defines the process lifetime in main.
on_process_start
Register a FnOnce(&ProcessStartArgs) closure to be called on init!.

Structs§

About
Metadata about the app and main crate.
ProcessExitArgs
Arguments for on_process_exit handlers.
ProcessStartArgs
Arguments for on_process_start handlers.

Enums§

ProcessLifetimeState
Defines the state of the current process instance.

Functions§

about
Gets metadata about the application.
android_install_res
Helper function for adapting Android assets to the cross-platform res API.
assert_inited
Panics with an standard message if zng::env::init!() was not called or was not called correctly.
bin
Gets a path relative to the package binaries.
cache
Gets a path relative to the cache directory for the app.
clear_cache
Removes all cache files possible.
config
Gets a path relative to the user config directory for the app.
exit
Terminates the current process with the specified exit code.
init_built_res
Sets a custom path for the “built resources” override checked by res in debug builds.
init_cache
Sets a custom cache path.
init_config
Sets a custom original_config path.
init_process_name
Set the process runtime name if it has not been named yet.
init_res
Sets a custom res path.
migrate_cache
Save new_path as the new cache path and make a best effort to move existing cache files.
migrate_config
Copies all config to new_path and saves it as the config path.
on_process_exit
Register a handler to run once when the current process exits.
original_config
Config path before migration.
process_lifetime_state
Get the state of the current process instance.
process_name
Gets a process runtime name.
res
Gets a path relative to the package resources.
set_process_name
Changes the process runtime name.