Skip to content

Instantly share code, notes, and snippets.

@riskable
Created April 23, 2022 21:58
Show Gist options
  • Save riskable/3c2493723e60c5deebe32f15edfea35d to your computer and use it in GitHub Desktop.
Save riskable/3c2493723e60c5deebe32f15edfea35d to your computer and use it in GitHub Desktop.
//! Build-time constants that get automatically generated from `Config.toml`
//! via `build.rs`
use core::include;
include!(concat!(env!("OUT_DIR"), "/userconfig.rs"));
@riskable
Copy link
Author

This allows one to use <your package>::config in your main.rs (or whatever) like it was just a big file full of lines like:

pub const KEYBOARD_ACTUATION_THRESHOLD: u16 = 20;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment