Debian Codegraph @

third_party/rust/glean-core/src/system.rs

raw
1 // Copyright (c) 2017 The Rust Project Developers
2 // Copyright (c) 2018-2020 The Rust Secure Code Working Group
3 // Licensed under the MIT License.
4 // Original license:
5 // https://github.com/rustsec/rustsec/blob/2a080f173ad9d8ac7fa260f0a3a6aebf0000de06/platforms/LICENSE-MIT
6 //
7 // Permission is hereby granted, free of charge, to any
8 // person obtaining a copy of this software and associated
9 // documentation files (the "Software"), to deal in the
10 // Software without restriction, including without
11 // limitation the rights to use, copy, modify, merge,
12 // publish, distribute, sublicense, and/or sell copies of
13 // the Software, and to permit persons to whom the Software
14 // is furnished to do so, subject to the following
15 // conditions:
16 //
17 // The above copyright notice and this permission notice
18 // shall be included in all copies or substantial portions
19 // of the Software.
20 //
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
22 // ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
23 // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
24 // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
25 // SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
26 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
28 // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 // DEALINGS IN THE SOFTWARE.
30
31 //! Detect and expose `target_os` as a constant.
32 //!
33 //! Code adopted from the "platforms" crate: <https://github.com/rustsec/rustsec/tree/2a080f173ad9d8ac7fa260f0a3a6aebf0000de06/platforms>.
34
35 #[cfg(target_os = "android")]
36 /// `target_os` when building this crate: `android`
37 pub const OS: &str = "Android";
38
39 #[cfg(target_os = "ios")]
40 /// `target_os` when building this crate: `ios`
41 pub const OS: &str = "iOS";
42
43 #[cfg(target_os = "linux")]
44 /// `target_os` when building this crate: `linux`
45 pub const OS: &str = "Linux";
46
47 #[cfg(target_os = "macos")]
48 /// `target_os` when building this crate: `macos`
49 pub const OS: &str = "Darwin";
50
51 #[cfg(target_os = "windows")]
52 /// `target_os` when building this crate: `windows`
53 pub const OS: &str = "Windows";
54
55 #[cfg(target_os = "freebsd")]
56 /// `target_os` when building this crate: `freebsd`
57 pub const OS: &str = "FreeBSD";
58
59 #[cfg(target_os = "netbsd")]
60 /// `target_os` when building this crate: `netbsd`
61 pub const OS: &str = "NetBSD";
62
63 #[cfg(target_os = "openbsd")]
64 /// `target_os` when building this crate: `openbsd`
65 pub const OS: &str = "OpenBSD";
66
67 #[cfg(target_os = "solaris")]
68 /// `target_os` when building this crate: `solaris`
69 pub const OS: &str = "Solaris";
70
71 #[cfg(not(any(
72 target_os = "android",
73 target_os = "ios",
74 target_os = "linux",
75 target_os = "macos",
76 target_os = "windows",
77 target_os = "freebsd",
78 target_os = "netbsd",
79 target_os = "openbsd",
80 target_os = "solaris",
81 )))]
82 pub const OS: &str = "Unknown";