Debian Codegraph @

lib.rs

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 #![cfg_attr(not(feature = "std"), no_std)]
2
3 mod corerust-analyzer cargo is_debug 1.1.0 core/ {
4 #[cfg(not(feature = "std"))]
5 pub use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::*;
6 #[cfg(feature = "std")]
7 pub use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::*;
8 }
9 pub use selfrust-analyzer cargo is_debug 1.1.0 crate/::corerust-analyzer cargo is_debug 1.1.0 core/::cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#;
10 pub use selfrust-analyzer cargo is_debug 1.1.0 crate/::corerust-analyzer cargo is_debug 1.1.0 core/::preluderust-analyzer cargo std https://github.com/rust-lang/rust/library/std prelude/::*;
11 pub use selfrust-analyzer cargo is_debug 1.1.0 crate/::corerust-analyzer cargo is_debug 1.1.0 core/::{cfgrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/cfg!, fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/, fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#, matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!};
12
13 pub enum BuildModelrust-analyzer cargo is_debug 1.1.0 BuildModel# {
14 Debugrust-analyzer cargo is_debug 1.1.0 BuildModel#Debug#,
15 Releaserust-analyzer cargo is_debug 1.1.0 BuildModel#Release#,
16 }
17
18 pub const fn build_channelrust-analyzer cargo is_debug 1.1.0 build_channel().() -> BuildModelrust-analyzer cargo is_debug 1.1.0 BuildModel# {
19 if cfgrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/cfg!!(debug_assertions) {
20 return BuildModelrust-analyzer cargo is_debug 1.1.0 BuildModel#::Debugrust-analyzer cargo is_debug 1.1.0 BuildModel#Debug#;
21 }
22 BuildModelrust-analyzer cargo is_debug 1.1.0 BuildModel#::Releaserust-analyzer cargo is_debug 1.1.0 BuildModel#Release#
23 }
24
25 impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for BuildModelrust-analyzer cargo is_debug 1.1.0 BuildModel# {
26 fn fmtrust-analyzer cargo is_debug 1.1.0 impl#[BuildModel][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
27 match self {
28 Selfrust-analyzer cargo is_debug 1.1.0 impl#[BuildModel][Display]::Debugrust-analyzer cargo is_debug 1.1.0 BuildModel#Debug# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("debug"),
29 Selfrust-analyzer cargo is_debug 1.1.0 impl#[BuildModel][Display]::Releaserust-analyzer cargo is_debug 1.1.0 BuildModel#Release# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("release"),
30 }
31 }
32 }
33 pub const fn is_debugrust-analyzer cargo is_debug 1.1.0 is_debug().() -> bool {
34 matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(build_channelrust-analyzer cargo is_debug 1.1.0 build_channel().(), BuildModelrust-analyzer cargo is_debug 1.1.0 BuildModel#::Debugrust-analyzer cargo is_debug 1.1.0 BuildModel#Debug#)
35 }
36
37 pub const fn is_releaserust-analyzer cargo is_debug 1.1.0 is_release().() -> bool {
38 matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(build_channelrust-analyzer cargo is_debug 1.1.0 build_channel().(), BuildModelrust-analyzer cargo is_debug 1.1.0 BuildModel#::Releaserust-analyzer cargo is_debug 1.1.0 BuildModel#Release#)
39 }
40
•41 /*
42 #[cfg(test)]
43 mod tests {
44 use xshell::{cmd, Shell};
45
46 #[test]
47 fn test_std() {
48 let sh = Shell::new().unwrap();
49 let repo = "is_debug_test";
50 let _ = cmd!(sh, "rm -rf {repo}").run();
51 cmd!(sh, "cargo new {repo}").run().unwrap();
52 sh.change_dir(repo);
53 let cargo_content = r#"
54 [package]
55 name = "is_debug_test"
56 version = "0.1.0"
57 edition = "2021"
58
59 [dependencies]
60 is_debug = {path = "../"}
61 "#;
62
63 sh.write_file("Cargo.toml", cargo_content).unwrap();
64
65 let main_debug = r#"
66 fn main() {
67 assert!(is_debug::is_debug())
68 }
69 "#;
70
71 let main_release = r#"
72 fn main() {
73 assert!(is_debug::is_release())
74 }
75 "#;
76 sh.write_file("src/main.rs", main_debug).unwrap();
77 cmd!(sh, "cargo run").run().unwrap();
78 sh.write_file("src/main.rs", main_release).unwrap();
79 cmd!(sh, "cargo run --release").run().unwrap();
80
81 cmd!(sh, "rm -rf ../{repo}").run().unwrap();
82 }
83 }
•84 */