rust_info/
types.rs

1//! # types
2//!
3//! Defines the various types and aliases.
4//!
5
6#[cfg(test)]
7#[path = "./types_test.rs"]
8mod types_test;
9
10#[derive(Debug, Clone, PartialEq, Copy)]
11#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
12/// Rust channel type
13pub enum RustChannel {
14    /// Rust stable channel
15    Stable,
16    /// Rust beta channel
17    Beta,
18    /// Rust nightly channel
19    Nightly,
20}
21
22#[derive(Debug, Clone, PartialEq, Default)]
23#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
24/// Holds the current rust installation and setup information
25pub struct RustInfo {
26    /// version
27    pub version: Option<String>,
28    /// channel
29    pub channel: Option<RustChannel>,
30    /// target arch cfg value
31    pub target_arch: Option<String>,
32    /// target env cfg value
33    pub target_env: Option<String>,
34    /// target OS cfg value
35    pub target_os: Option<String>,
36    /// target pointer width cfg value
37    pub target_pointer_width: Option<String>,
38    /// target vendor cfg value
39    pub target_vendor: Option<String>,
40    /// target triple constructed from target arc, vendor, os and env
41    pub target_triple: Option<String>,
42}
43
44impl RustInfo {
45    /// Returns new instance
46    pub fn new() -> RustInfo {
47        Default::default()
48    }
49}