Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
zng
Zng is a cross-platform GUI framework, it provides ready made highly customizable widgets, responsive layout, live data binding, easy localization, automatic focus navigation and accessibility, async and multi-threaded tasks, robust multi-process architecture and more.
Zng is pronounced "zing", or as an initialism: ZNG (z+nesting+graphics).
Usage
First add this to your Cargo.toml:
[]
= { = "0.3.0", = ["view_prebuilt"] }
Then create your first window:
use *;
See the API docs for more details.
Cargo Features
Zng provides the following features which can be enabled in your Cargo.toml file:
view— Include the default view-process implementation.view_prebuilt— Include the default view-process implementation as an embedded precompiled binary.inspector— Instrument each property and widget instance with inspector nodes and extend windows to be inspected on Ctrl+Shift+I.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.deadlock_detection— Spawns a thread on app creation that checks and printsparking_lotdeadlocks.http— Enables HTTP tasks, images download.test_util— Test utilities.multi_app— Allows multiple app instances per-process, one app per thread at a time. TheLocalContexttracks what app is currently running in each thread andapp_local!statics switch to the value of each app depending on the current thread.hyphenation_embed_all— Embed hyphenation dictionaries for all supported languages. If enabled some 2.8MB of data is embedded, you can provide an alternative dictionary source using theHyphenation::dictionary_sourcemethod.dyn_node— Use more dynamic dispatch at the node level by enablingUiNode::cfg_boxedto box.dyn_app_extension— Use dynamic dispatch at the app-extension level.dyn_closure— Box closures at opportune places, such asVar::map, reducing the number of monomorphised types.toml— Enable TOML configs.ron— Enable RON configs.yaml— Enable YAML configs.material_icons— Include all Material Icons icon sets, each icon set embeds some 300KB of data.material_icons_outlinedInclude Material Icons Outlined icon set. If enabled some icons of this set are used for some of the commands.material_icons_filledInclude Material Icons Filled icon set.material_icons_roundedInclude Material Icons Rounded icon set.material_icons_sharpInclude Material Icons Sharp icon set.
These features are enabled by default:
debug_default— Enable the"dyn_*"and"inspector"features for debug builds only.ipc— Enables pre-build views and connecting to views running in another process.view_software— Enables software renderer fallback in the default view-process ("view").
Requirements
On Windows:
- To build with
"view"and"view_software"feature:- Env vars
CCandCXXmust be set to "clang-cl". - You can install clang using the Visual Studio installer or by installing LLVM directly.
- Env vars
On Windows 8 or older:
- To build with
"view_prebuilt"feature:- The
curlcommand is required, it is available in Windows 10+, but must be installed in older Windows and must be added to the PATH env var.
- The
on Linux:
-
Packages needed to build:
pkg-configlibfontconfig1-dev
-
Packages needed to build with
"http"feature:libssl-dev
-
Packages needed to build with
"view_prebuilt"feature:curl
cargo do
Do is a built-in task runner for managing this project, run cargo do help or ./do help for details.
The task runner is implemented as a Rust crate in tools/do-tasks and an alias in .cargo/config.toml.
The builds the tool silently in the first run, after, it runs without noticeable delay.
Shell script to run do are also provided:
- cmd.exe:
do help. - PowerShell:
./do.ps1 help. - Bash:
/.do help.
cargo do run <example>
The task runner can be used to run the examples in ./examples folder, for example: cargo do run calculator runs the
./examples/calculator.rs example.
cargo do install
The task runner depends on multiple cargo commands, you can run cargo do install to see a list of all required commands and run cargo do install --accept to run the installation commands.
VSCode & Rust Analyzer
Some workspace settings are included in the repository, in particular, rust-analyzer "checkOnSave"
and runnables are redirected to the do tool.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.