Compare commits
No commits in common. "3b8681360f8878e9c5039a3a2f3704b39fe5aa5a" and "4bfaf425f0730aa1ceae63302fd86cf11d368270" have entirely different histories.
3b8681360f
...
4bfaf425f0
6 changed files with 9 additions and 10 deletions
|
@ -3,9 +3,6 @@ name = "narinfo"
|
|||
version = "1.0.0"
|
||||
edition = "2021"
|
||||
description = "A parser for the narinfo file format"
|
||||
repository = "https://im.badat.dev/bad/narinfo-rs"
|
||||
license = "MIT OR Apache-2.0"
|
||||
keywords = ["nix", "nixos"]
|
||||
|
||||
[dependencies]
|
||||
derive_builder = { version = "0.11.2", default-features = false }
|
||||
|
|
|
@ -11,5 +11,5 @@ mod nix_cache_info;
|
|||
mod sig;
|
||||
|
||||
pub use crate::narinfo::NarInfo;
|
||||
pub use nix_cache_info::NixCacheInfo;
|
||||
pub use sig::Sig;
|
||||
pub use nix_cache_info::NixCacheInfo;
|
||||
|
|
|
@ -20,6 +20,7 @@ impl<'a> NarInfo<'a> {
|
|||
///
|
||||
/// let parsed = NarInfo::parse(data).unwrap();
|
||||
/// assert_eq!(parsed.store_path, "/nix/store/zzxrhj9056vjlanfjkinvhd7458yc2z8-liblouis-3.22.0");
|
||||
///
|
||||
/// ```
|
||||
pub fn parse(value: &'a str) -> ParsingResult<Self> {
|
||||
let mut builder = NarInfoBuilder::default();
|
||||
|
|
|
@ -59,8 +59,8 @@ pub struct NarInfo<'a> {
|
|||
impl<'a> NarInfo<'a> {
|
||||
/// Get the builder for this struct.
|
||||
/// The builder is generated by [derive_builder](https://lib.rs/crates/derive_builder)
|
||||
// The builder is is used internally by the parsing code so we might as well expose it.
|
||||
// If we ever decide to not use derive_builder we can simply hide it behind an optional feature flag
|
||||
// The builder is is used internally by the parsing code so we might as well expose it.
|
||||
// If we ever decide to not use derive_builder we can simply hide it behind an optional feature flag
|
||||
pub fn builder() -> NarInfoBuilder<'a> {
|
||||
NarInfoBuilder::default()
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ use derive_builder::Builder;
|
|||
|
||||
/// Struct representing the nix-cache-info file fetched from a nix substituter, describing the
|
||||
/// substituter
|
||||
/// Based on the [unofficial spec](https://fzakaria.github.io/nix-http-binary-cache-api-spec)
|
||||
/// Based on the [unofficial spec](https://fzakaria.github.io/nix-http-binary-cache-api-spec)
|
||||
/// and the [libstore narinfo parsing code.](https://github.com/NixOS/nix/blob/af4e8b00fb986acf32d7e4cd4fff7218b38958df/src/libstore/binary-cache-store.cc#L37)
|
||||
#[derive(Builder, Eq, PartialEq, Debug)]
|
||||
#[builder(no_std)]
|
||||
|
@ -38,6 +38,7 @@ impl<'a> NixCacheInfo<'a> {
|
|||
///
|
||||
/// let parsed = NixCacheInfo::parse(data).unwrap();
|
||||
/// assert_eq!(parsed.store_dir, "/nix/store");
|
||||
///
|
||||
/// ```
|
||||
pub fn parse(value: &'a str) -> ParsingResult<Self> {
|
||||
let mut builder = NixCacheInfoBuilder::default();
|
||||
|
@ -77,8 +78,8 @@ impl<'a> NixCacheInfo<'a> {
|
|||
|
||||
/// Get the builder for this struct.
|
||||
/// The builder is generated by [derive_builder](https://lib.rs/crates/derive_builder)
|
||||
// The builder is is used internally by the parsing code so we might as well expose it.
|
||||
// If we ever decide to not use derive_builder we can simply hide it behind an optional feature flag
|
||||
// The builder is is used internally by the parsing code so we might as well expose it.
|
||||
// If we ever decide to not use derive_builder we can simply hide it behind an optional feature flag
|
||||
pub fn builder() -> NixCacheInfoBuilder<'a> {
|
||||
NixCacheInfoBuilder::default()
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ impl<'a> TryFrom<&'a str> for Sig<'a> {
|
|||
}
|
||||
}
|
||||
// Neither the parse nor the serializa method is public since
|
||||
// it doesn't really make sense to de/serialize the
|
||||
// it doesn't really make sense to de/serialize the
|
||||
// sig into the narinfo format outside of de/serializing a whole narinfo
|
||||
impl<'a> Sig<'a> {
|
||||
pub(crate) fn parse(value: &'a str) -> ParsingResult<Self> {
|
||||
|
|
Loading…
Reference in a new issue