alpm_srcinfo::parser

Struct ArchProperty

Source
pub struct ArchProperty<T> {
    pub architecture: Option<Architecture>,
    pub value: T,
}
Expand description

An arbitrarily typed attribute that is specific to an alpm-architecture.

This type is designed to wrap any type that is architecture specific. For example, all checksums may be architecture specific.

§Example

# Without architecture
sha256 = 0db1b39fd70097c6733cdcce56b1559ece5521ec1aad9ee1d520dda73eff03d0

# With architecture
sha256_x86_64 = 0db1b39fd70097c6733cdcce56b1559ece5521ec1aad9ee1d520dda73eff03d0

The above would be reflected by the following code.

use std::str::FromStr;

use alpm_srcinfo::parser::ArchProperty;
use alpm_types::{Architecture, Sha256Checksum};

let without_architecture = ArchProperty {
    architecture: None,
    value: Sha256Checksum::from_str(
        "0db1b39fd70097c6733cdcce56b1559ece5521ec1aad9ee1d520dda73eff03d0",
    )?,
};

let with_architecture = ArchProperty {
    architecture: Some(Architecture::X86_64),
    value: Sha256Checksum::from_str(
        "0db1b39fd70097c6733cdcce56b1559ece5521ec1aad9ee1d520dda73eff03d0",
    )?,
};

Fields§

§architecture: Option<Architecture>

The optional [alpm-architecture] of the value.

If architecture is None it is considered to be "any". [alpm-architecture]: https://alpm.archlinux.page/specifications/alpm-architecture.7.html

§value: T

Trait Implementations§

Source§

impl<T: Debug> Debug for ArchProperty<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for ArchProperty<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for ArchProperty<T>
where T: RefUnwindSafe,

§

impl<T> Send for ArchProperty<T>
where T: Send,

§

impl<T> Sync for ArchProperty<T>
where T: Sync,

§

impl<T> Unpin for ArchProperty<T>
where T: Unpin,

§

impl<T> UnwindSafe for ArchProperty<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T