Struct nix_compat::narinfo::NarInfo

source ·
pub struct NarInfo<'a> {
Show 13 fields pub flags: Flags, pub store_path: StorePathRef<'a>, pub nar_hash: [u8; 32], pub nar_size: u64, pub references: Vec<StorePathRef<'a>>, pub signatures: Vec<Signature<'a>>, pub ca: Option<CAHash>, pub system: Option<&'a str>, pub deriver: Option<StorePathRef<'a>>, pub url: &'a str, pub compression: Option<&'a str>, pub file_hash: Option<[u8; 32]>, pub file_size: Option<u64>,
}

Fields§

§flags: Flags§store_path: StorePathRef<'a>

Store path described by this NarInfo

§nar_hash: [u8; 32]

SHA-256 digest of the NAR file

§nar_size: u64

Size of the NAR file in bytes

§references: Vec<StorePathRef<'a>>

Store paths known to be referenced by the contents

§signatures: Vec<Signature<'a>>

Ed25519 signature over the path fingerprint

§ca: Option<CAHash>

Content address (for content-defined paths)

§system: Option<&'a str>

Nix system triple of NarInfo::deriver

§deriver: Option<StorePathRef<'a>>

Store path of the derivation that produced this. The last .drv suffix is stripped.

§url: &'a str

Relative URL of the compressed NAR file

§compression: Option<&'a str>

Compression method of the NAR file None means Compression: none.

Nix interprets a missing Compression field as Some("bzip2"), so we do as well. We haven’t found any examples of this in the wild, not even in the cache.nixos.org dataset.

§file_hash: Option<[u8; 32]>

SHA-256 digest of the file at url

§file_size: Option<u64>

Size of the file at url in bytes

Implementations§

source§

impl<'a> NarInfo<'a>

source

pub fn parse(input: &'a str) -> Result<Self, Error>

source

pub fn fingerprint(&self) -> String

Computes the fingerprint string for certain fields in this NarInfo. This fingerprint is signed in [self.signatures].

source

pub fn add_signature<S>(&mut self, signer: &'a SigningKey<S>)
where S: Signer<Signature>,

Adds a signature, using the passed signer to sign. This is generic over algo implementations / providers, so users can bring their own signers.

Trait Implementations§

source§

impl<'a> Debug for NarInfo<'a>

source§

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

Formats the value using the given formatter. Read more
source§

impl Display for NarInfo<'_>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for NarInfo<'a>

§

impl<'a> RefUnwindSafe for NarInfo<'a>

§

impl<'a> Send for NarInfo<'a>

§

impl<'a> Sync for NarInfo<'a>

§

impl<'a> Unpin for NarInfo<'a>

§

impl<'a> UnwindSafe for NarInfo<'a>

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

§

type Output = T

Should always be Self
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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>,

§

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.