#cargo-toml #cargo-build #compile-time #information #mcai #package #export

build mcai_build

A small crate exporting information from Cargo.toml at compile time

5 unstable releases

0.3.1 Aug 26, 2024
0.3.0 Aug 26, 2024
0.2.0 Sep 2, 2022
0.1.2 Jul 1, 2022
0.1.1 May 31, 2022

#266 in Build Utils

Download history 336/week @ 2024-08-23 50/week @ 2024-08-30 122/week @ 2024-09-06 112/week @ 2024-09-13 61/week @ 2024-09-20 22/week @ 2024-09-27 5/week @ 2024-10-04 16/week @ 2024-10-11 2/week @ 2024-10-18 35/week @ 2024-10-25 63/week @ 2024-11-01 267/week @ 2024-11-08 104/week @ 2024-11-15 385/week @ 2024-11-22 88/week @ 2024-11-29 47/week @ 2024-12-06

711 downloads per month
Used in mcai_worker_sdk

MIT license

4KB

MCAI Build

This crate allows to export information form Cargo.toml at compile time.


lib.rs:

MCAI Build

This crates allows to export Cargo.toml variables at compile time, so that they can be used at execution time.

Usage

  1. Add mcai_build in the build-dependencies of your package.
  2. Add serde_json in the dependencies of your package.
  3. Add a build.rs file next to your Cargo.toml that contains the following code:
fn main() {
  mcai_build::build_mcai_info()
}
  1. You can now use the exported variables in your code:
use cargo_toml::Package;

let package: Package = include!(concat!(env!("OUT_DIR"), "/mcai_build.rs"));

Dependencies

~4.5MB
~41K SLoC