docs(tvix/nix-compat): document the name ordering requirement

Change-Id: Ia2c5f0b357a23d4bfac1fd52cf01845c78ebfa22
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9612
Autosubmit: edef <edef@edef.eu>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
edef 2023-10-09 17:51:19 +00:00
parent 49b106b0cb
commit ca1ede17cb

View file

@ -163,6 +163,10 @@ impl<'a, 'w> Directory<'a, 'w> {
/// ///
/// The entry is simply another [`Node`], which can then be filled like the /// The entry is simply another [`Node`], which can then be filled like the
/// root of a NAR (including, of course, by nesting directories). /// root of a NAR (including, of course, by nesting directories).
///
/// It is the caller's responsibility to ensure that directory entries are
/// written in order of ascending name. If this is not ensured, this method
/// may panic or silently produce invalid archives.
pub fn entry(&mut self, name: &[u8]) -> io::Result<Node<'_, 'w>> { pub fn entry(&mut self, name: &[u8]) -> io::Result<Node<'_, 'w>> {
debug_assert!( debug_assert!(
name.len() <= wire::MAX_NAME_LEN, name.len() <= wire::MAX_NAME_LEN,