Crate gelx_build

Source
Expand description

§gelx_build


By default the gelx macros can’t read the configuration from the Cargo.toml file. This crate provides a way to read the configuration from the Cargo.toml file using the build.rs script.


Crate Docs Status Unlicense codecov

§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§

GelxMetadata
The metadata for the gelx crate. This can either be specified in the Cargo.toml file or via CLI arguments.

Enums§

GelxCoreError
The error type for the gelx_core crate.

Functions§

gelx_build
Enables reading from the configuration in the Cargo.toml. This returns the GelxMetadata struct which can be used to customise the generated code via set_metadata_env.
gelx_build_sync
Enables reading from the configuration in the Cargo.toml in a sync environment. See gelx_build for more information.
set_metadata_env
Sets the GELX_METADATA_BASE64 environment variable to the base64 encoded GelxMetadata struct.

Type Aliases§

GelxCoreResult