Skip to main content

uv_python/
architecture.rs

1use std::fmt::{self, Display, Formatter};
2use std::str::FromStr;
3
4use uv_platform::Arch;
5
6/// The architecture to use when a Python request does not specify one.
7#[derive(Debug, Clone, Copy, PartialEq, Eq)]
8pub struct PythonArchitecture(Arch);
9
10impl PythonArchitecture {
11    pub fn into_inner(self) -> Arch {
12        self.0
13    }
14}
15
16impl FromStr for PythonArchitecture {
17    type Err = uv_platform::Error;
18
19    fn from_str(value: &str) -> Result<Self, Self::Err> {
20        value.parse().map(Self)
21    }
22}
23
24impl Display for PythonArchitecture {
25    fn fmt(&self, formatter: &mut Formatter<'_>) -> fmt::Result {
26        self.0.fmt(formatter)
27    }
28}