pub enum Architecture {
Any,
Some(SystemArchitecture),
}Expand description
A valid alpm-architecture, either “any” or a specific SystemArchitecture.
Members of the Architecture enum can be created from &str.
§Examples
use std::str::FromStr;
use alpm_types::{Architecture, SystemArchitecture, UnknownArchitecture};
// create Architecture from str
assert_eq!(
Architecture::from_str("aarch64"),
Ok(SystemArchitecture::Aarch64.into())
);
assert_eq!(Architecture::from_str("any"), Ok(Architecture::Any));
// format as String
assert_eq!("any", format!("{}", Architecture::Any));
assert_eq!(
"x86_64",
format!("{}", Architecture::Some(SystemArchitecture::X86_64))
);
assert_eq!(
"custom_arch",
format!("{}", Architecture::from_str("custom_arch")?)
);Variants§
Implementations§
Source§impl Architecture
impl Architecture
Sourcepub fn parser(input: &mut &str) -> ModalResult<Architecture>
pub fn parser(input: &mut &str) -> ModalResult<Architecture>
Recognizes an Architecture in an input string.
Consumes all input and returns an error if the string doesn’t match any architecture.
Trait Implementations§
Source§impl Clone for Architecture
impl Clone for Architecture
Source§fn clone(&self) -> Architecture
fn clone(&self) -> Architecture
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Architecture
impl Debug for Architecture
Source§impl<'de> Deserialize<'de> for Architecture
impl<'de> Deserialize<'de> for Architecture
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for Architecture
impl Display for Architecture
Source§impl From<Architecture> for Architectures
impl From<Architecture> for Architectures
Source§fn from(value: Architecture) -> Self
fn from(value: Architecture) -> Self
Converts a single Architecture into an Architectures.
Source§impl From<SystemArchitecture> for Architecture
impl From<SystemArchitecture> for Architecture
Source§fn from(value: SystemArchitecture) -> Self
fn from(value: SystemArchitecture) -> Self
Converts a SystemArchitecture into an Architecture.
Source§impl From<UnknownArchitecture> for Architecture
impl From<UnknownArchitecture> for Architecture
Source§fn from(value: UnknownArchitecture) -> Self
fn from(value: UnknownArchitecture) -> Self
Converts an UnknownArchitecture into an Architecture.
Source§impl FromStr for Architecture
impl FromStr for Architecture
Source§fn from_str(s: &str) -> Result<Architecture, Self::Err>
fn from_str(s: &str) -> Result<Architecture, Self::Err>
Creates an Architecture from a string slice.
Delegates to Architecture::parser.
§Errors
Returns an error if Architecture::parser fails.
Source§impl Hash for Architecture
impl Hash for Architecture
Source§impl Ord for Architecture
impl Ord for Architecture
Source§fn cmp(&self, other: &Architecture) -> Ordering
fn cmp(&self, other: &Architecture) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for Architecture
impl PartialEq for Architecture
Source§impl PartialOrd for Architecture
impl PartialOrd for Architecture
Source§impl Serialize for Architecture
impl Serialize for Architecture
Source§impl VariantNames for Architecture
impl VariantNames for Architecture
impl Eq for Architecture
impl StructuralPartialEq for Architecture
Auto Trait Implementations§
impl Freeze for Architecture
impl RefUnwindSafe for Architecture
impl Send for Architecture
impl Sync for Architecture
impl Unpin for Architecture
impl UnwindSafe for Architecture
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more