#[allow(unused_imports)]
use crate::platform::EnabledTernary;
use crate::{errors::TargetSpecError, platform::Platform};
use std::sync::Arc;
#[derive(Clone, Debug)]
#[non_exhaustive]
pub enum PlatformSpec {
Always,
Platform(Arc<Platform>),
Any,
}
impl PlatformSpec {
#[deprecated(
since = "0.17.13",
note = "this method has been renamed to `build_target`"
)]
#[inline]
pub fn current() -> Result<Self, TargetSpecError> {
Self::build_target()
}
pub fn build_target() -> Result<Self, TargetSpecError> {
Ok(PlatformSpec::Platform(Arc::new(Platform::build_target()?)))
}
}
impl<T: Into<Arc<Platform>>> From<T> for PlatformSpec {
#[inline]
fn from(platform: T) -> Self {
PlatformSpec::Platform(platform.into())
}
}