is_debug-1.0.1/.cargo_vcs_info.json0000644000000001120000000000100126060ustar { "git": { "sha1": "9f8dd56c6a9579225e771c3eb70ca6636038efcc" } } is_debug-1.0.1/.gitignore000064400000000000000000000000310072674642500134160ustar 00000000000000/target Cargo.lock .idea/is_debug-1.0.1/Cargo.toml0000644000000015270000000000100106170ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2018" name = "is_debug" version = "1.0.1" authors = ["baoyachi "] description = "get build model is debug" keywords = ["build", "build-model", "model", "debug", "release"] categories = ["development-tools", "development-tools::build-utils"] license = "MIT AND Apache-2.0" repository = "https://github.com/baoyachi/rust_is_debug" [dependencies] is_debug-1.0.1/Cargo.toml.orig000064400000000000000000000007450072674642500143310ustar 00000000000000[package] name = "is_debug" version = "1.0.1" authors = ["baoyachi "] description = "get build model is debug" keywords = ["build", "build-model", "model", "debug", "release"] categories = ["development-tools", "development-tools::build-utils"] repository = "https://github.com/baoyachi/rust_is_debug" license = "MIT AND Apache-2.0" edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies]is_debug-1.0.1/LICENSE000064400000000000000000000020510072674642500124370ustar 00000000000000MIT License Copyright (c) 2021 baoyachi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. is_debug-1.0.1/README.md000064400000000000000000000003170072674642500127140ustar 00000000000000# is_debug The crate by Rust that get build model is debug. ### use function ```TOML [dependencies] is_debug = "1" ``` ```rust fn main() { println!(is_debug()); println!(is_release()); } ``` is_debug-1.0.1/src/lib.rs000064400000000000000000000010710072674642500133360ustar 00000000000000#[derive(Debug, PartialEq)] pub enum BuildModel { Debug, Release, } pub fn build_channel() -> BuildModel { if cfg!(debug_assertions) { return BuildModel::Debug; } BuildModel::Release } impl ToString for BuildModel { fn to_string(&self) -> String { match self { Self::Debug => "debug".to_string(), Self::Release => "release".to_string(), } } } pub fn is_debug() -> bool { build_channel() == BuildModel::Debug } pub fn is_release() -> bool { build_channel() == BuildModel::Release }