Assert STORE_PATH_HASH_SIZE matches C struct

`zerocopy` is safe enough, but it's good to be explicit about this.
This commit is contained in:
Robert Hensing 2026-01-14 21:47:02 +01:00
parent 65abededca
commit 6619b881b3

View file

@ -12,6 +12,9 @@ use nix_bindings_util::{
/// The size of a store path hash in bytes (20 bytes, decoded from nix32).
pub const STORE_PATH_HASH_SIZE: usize = 20;
#[cfg(nix_at_least = "2.33")]
const _: () = assert!(std::mem::size_of::<raw::store_path_hash_part>() == STORE_PATH_HASH_SIZE);
pub struct StorePath {
raw: NonNull<raw::StorePath>,
}