Crates.io | env-cast |
lib.rs | env-cast |
version | 1.0.0 |
source | src |
created_at | 2022-02-15 07:20:35.671244 |
updated_at | 2022-02-15 07:20:35.671244 |
description | Macro to parse an environment variable to a numeric type at compile time |
homepage | |
repository | https://github.com/rob2309/env-cast-rs |
max_upload_size | |
id | 532609 |
size | 8,972 |
env_cast!
reads an environment variable just like env!("XXX")
, but parses it into a specific type.
Supported types are currently
i8, u8, i16, u16, i32, u32, i64, u64, f32, f64
.
use env_cast::env_cast;
let PKG_MAJOR: u32 = env_cast!("CARGO_PKG_VERSION_MAJOR" as u32);