1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
#[derive(Debug, PartialEq)] pub enum BuildRustChannel { Debug, Release, } impl Default for BuildRustChannel { fn default() -> Self { BuildRustChannel::Debug } } pub fn build_channel() -> BuildRustChannel { if cfg!(debug_assertions) { return BuildRustChannel::Debug; } BuildRustChannel::Release } impl ToString for BuildRustChannel { fn to_string(&self) -> String { match self { BuildRustChannel::Debug => "debug".to_string(), BuildRustChannel::Release => "release".to_string(), } } }