#[repr(u8)]pub enum PackageInstallReason {
Explicit = 0,
Depend = 1,
}Expand description
Represents the reason why a package was installed.
§Examples
Parsing from strings:
use std::str::FromStr;
use alpm_types::PackageInstallReason;
assert_eq!(
PackageInstallReason::from_str("0")?,
PackageInstallReason::Explicit
);
assert_eq!(
PackageInstallReason::from_str("1")?,
PackageInstallReason::Depend
);
// Invalid values return an error.
assert!(PackageInstallReason::from_str("2").is_err());Displaying and serializing:
use alpm_types::PackageInstallReason;
assert_eq!(PackageInstallReason::Explicit.to_string(), "0");
assert_eq!(
serde_json::to_string(&PackageInstallReason::Depend).expect("Serialization failed"),
"\"Depend\""
);Variants§
Explicit = 0
Explicitly requested by the user.
Depend = 1
Installed as a dependency for another package.
Trait Implementations§
Source§impl AsRef<str> for PackageInstallReason
impl AsRef<str> for PackageInstallReason
Source§impl Clone for PackageInstallReason
impl Clone for PackageInstallReason
Source§fn clone(&self) -> PackageInstallReason
fn clone(&self) -> PackageInstallReason
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 PackageInstallReason
impl Debug for PackageInstallReason
Source§impl Default for PackageInstallReason
impl Default for PackageInstallReason
Source§fn default() -> PackageInstallReason
fn default() -> PackageInstallReason
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for PackageInstallReason
impl<'de> Deserialize<'de> for PackageInstallReason
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 PackageInstallReason
impl Display for PackageInstallReason
Source§impl FromStr for PackageInstallReason
impl FromStr for PackageInstallReason
Source§impl PartialEq for PackageInstallReason
impl PartialEq for PackageInstallReason
Source§impl Serialize for PackageInstallReason
impl Serialize for PackageInstallReason
Source§impl TryFrom<&str> for PackageInstallReason
impl TryFrom<&str> for PackageInstallReason
impl Copy for PackageInstallReason
impl Eq for PackageInstallReason
impl StructuralPartialEq for PackageInstallReason
Auto Trait Implementations§
impl Freeze for PackageInstallReason
impl RefUnwindSafe for PackageInstallReason
impl Send for PackageInstallReason
impl Sync for PackageInstallReason
impl Unpin for PackageInstallReason
impl UnwindSafe for PackageInstallReason
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