usdpl_core/api_common/
target.rs

1/// Supported plugin platforms
2pub enum Platform {
3    /// Generic platform
4    Any,
5    /// Decky aka PluginLoader platform
6    Decky,
7}
8
9impl Platform {
10    /// The current platform that usdpl-core is configured to target.
11    /// This is determined by feature flags.
12    pub fn current() -> Self {
13        #[cfg(all(feature = "decky", not(any(feature = "crankshaft"))))]
14        {
15            Self::Decky
16        }
17        #[cfg(not(any(feature = "decky", feature = "crankshaft")))]
18        {
19            Self::Any
20        }
21    }
22}
23
24impl std::fmt::Display for Platform {
25    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
26        match self {
27            Self::Any => write!(f, "any"),
28            Self::Decky => write!(f, "decky"),
29        }
30    }
31}