Expand description
§gelx_build
By default the
gelx
macros can’t read the configuration from theCargo.toml
file. This crate provides a way to read the configuration from theCargo.toml
file using the build.rs script.
§Overview
The gelx_build
crate provides a way to read the configuration from the Cargo.toml
file using the build.rs
script.
This crate is only needed if you want to customise the configuration of the gelx
macros.
§Installation
[build-dependencies]
gelx_build = "0.8"
or via the command line:
cargo add --build gelx_build
§Usage
// build.rs
use gelx_build::gelx_build_sync;
fn main() {
let _ = gelx_build_sync();
}
The above code will read the configuration from the Cargo.toml
file and create an environment variable called GELX_METADATA_BASE64
that contains the json configuration. The GELX_METADATA_BASE64
environment variable is then used by the gelx_macros
crate to read the configuration and use it when generating code.
If you would like to use the async version, you can use the gelx_build
function instead.
// build.rs
use gelx_build::gelx_build;
use gelx_build::tokio;
#[tokio::main]
async fn main() {
let _ = gelx_build().await;
}
§Contributing
This crate is part of the gelx
workspace. Please refer to the main project's contributing guide for details on how to set up the development environment and contribute.
§License
Unlicense, see the license file in the root of the workspace.
Re-exports§
pub use tokio;
Structs§
- Gelx
Metadata - The metadata for the
gelx
crate. This can either be specified in theCargo.toml
file or via CLI arguments.
Enums§
- Gelx
Core Error - The error type for the
gelx_core
crate.
Functions§
- gelx_
build - Enables reading from the configuration in the
Cargo.toml
. This returns theGelxMetadata
struct which can be used to customise the generated code viaset_metadata_env
. - gelx_
build_ sync - Enables reading from the configuration in the
Cargo.toml
in a sync environment. Seegelx_build
for more information. - set_
metadata_ env - Sets the
GELX_METADATA_BASE64
environment variable to the base64 encodedGelxMetadata
struct.