Crates.io | esp-config |
lib.rs | esp-config |
version | |
source | src |
created_at | 2024-10-10 10:54:02.851455 |
updated_at | 2024-11-20 09:35:39.789398 |
description | Configure projects using esp-hal and related packages |
homepage | |
repository | https://github.com/esp-rs/esp-hal |
max_upload_size | |
id | 1403700 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
esp-config
takes a prefix (usually the crate name) and a set of configuration keys and default values to produce a configuration system that supports:
0x
, 0o
and 0b
prefixes.The possible configuration values are output as a markdown table in the crates OUT_DIR
with the format {prefix}_config_table.md
, this can then be included into the crates top level documentation. Here is an example of the output:
Name | Description | Default value |
---|---|---|
ESP_HAL_PLACE_SPI_DRIVER_IN_RAM | Places the SPI driver in RAM for better performance | false |
For any available configuration option, the environment variable or cfg is always set based on the default value specified in the table. Users can override this by setting environment variables locally in their shell or the preferred option is to utilize cargo's env
section.
It's important to note that due to a bug in cargo, any modifications to the environment, local or otherwise will only get picked up on a full clean build of the project.
To see the final selected configuration another table is output to the OUT_DIR
with the format {prefix}_selected_config.md
.
For all supported data types, there are helper macros that emit const
code for parsing the configuration values.
esp_config_int!(integer_type, "ENV")
esp_config_str!("ENV")
esp_config_bool!("ENV")
In addition to environment variables, for boolean types rust cfg
's are emitted in snake case without the prefix.
This crate is guaranteed to compile on stable Rust 1.79 and up. It might compile with older versions but that may change in any new patch release.
Licensed under either of:
at your option.
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.