Module nix_compat::nar::writer::async
source · Expand description
Implements an interface for writing the Nix archive format (NAR).
NAR files (and their hashed representations) are used in C++ Nix for addressing fixed-output derivations and a variety of other things.
NAR files can be output to any type that implements AsyncWrite
, and content
can be read from any type that implementes AsyncBufRead
.
Writing a single file might look like this:
// Output location to write the NAR to.
let mut sink: Vec<u8> = Vec::new();
// Instantiate writer for this output location.
let mut nar = nix_compat::nar::writer::r#async::open(&mut sink).await?;
// Acquire metadata for the single file to output, and pass it in a
// `BufRead`-implementing type.
let executable = false;
let size = some_file.len() as u64;
let mut reader = BufReader::new(some_file.as_slice());
nar.file(executable, size, &mut reader).await?;
Structs§
- Content of a NAR node that represents a directory.
- Single node in a NAR file.
Functions§
- Create a new NAR, writing the output to the specified writer.
Type Aliases§
- Name 🔒
- Convenience type alias for types implementing
AsyncWrite
.