canic_core/ids/
network.rs

1use std::fmt::{self, Display};
2
3///
4/// BuildNetwork
5/// Identifies the environment the canister believes it runs in.
6///
7
8#[derive(Clone, Copy, Debug, Eq, PartialEq)]
9pub enum BuildNetwork {
10    Ic,
11    Local,
12}
13
14impl BuildNetwork {
15    #[must_use]
16    pub const fn as_str(self) -> &'static str {
17        match self {
18            Self::Ic => "ic",
19            Self::Local => "local",
20        }
21    }
22}
23
24impl Display for BuildNetwork {
25    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
26        f.write_str(self.as_str())
27    }
28}