pub trait FsVerityHashValuewhere
Self: Clone + From<Output<Self::Digest>> + FromBytes + Immutable + IntoBytes + KnownLayout + Unaligned + Hash + Eq + Debug + Send + Sync + Unpin + 'static,{
type Digest: Digest + FixedOutputReset + Debug;
const ALGORITHM: u8;
const EMPTY: Self;
const ID: &str;
// Provided methods
fn from_hex(hex: impl AsRef<[u8]>) -> Result<Self, FromHexError> { ... }
fn from_object_dir_and_basename(
dirnum: u8,
basename: impl AsRef<[u8]>,
) -> Result<Self, FromHexError> { ... }
fn from_object_pathname(
pathname: impl AsRef<[u8]>,
) -> Result<Self, FromHexError> { ... }
fn to_object_pathname(&self) -> String { ... }
fn to_object_dir(&self) -> String { ... }
fn to_hex(&self) -> String { ... }
fn to_id(&self) -> String { ... }
}Expand description
Trait for fs-verity hash value types supporting SHA-256 and SHA-512.
This trait defines the interface for hash values used in fs-verity operations, including serialization to/from hex strings and object store pathnames.
Required Associated Constants§
Required Associated Types§
Provided Methods§
Sourcefn from_object_dir_and_basename(
dirnum: u8,
basename: impl AsRef<[u8]>,
) -> Result<Self, FromHexError>
fn from_object_dir_and_basename( dirnum: u8, basename: impl AsRef<[u8]>, ) -> Result<Self, FromHexError>
Parse a hash value from an object store directory number and basename.
Object stores typically use a two-level hierarchy where the first byte of the hash determines the directory name and the remaining bytes form the basename.
§Arguments
dirnum- The directory number (first byte of the hash)basename- The hexadecimal basename (remaining bytes)
§Returns
The parsed hash value, or an error if the input is invalid.
Sourcefn from_object_pathname(
pathname: impl AsRef<[u8]>,
) -> Result<Self, FromHexError>
fn from_object_pathname( pathname: impl AsRef<[u8]>, ) -> Result<Self, FromHexError>
Parse a hash value from a full object pathname.
Parses a pathname in the format “xx/yyyyyy” where “xxyyyyyy” is the full hexadecimal hash. The prefix before the two-level hierarchy is ignored.
§Arguments
pathname- The object pathname (e.g., “ab/cdef1234…”)
§Returns
The parsed hash value, or an error if the input is invalid.
Sourcefn to_object_pathname(&self) -> String
fn to_object_pathname(&self) -> String
Convert the hash value to an object pathname.
Formats the hash as “xx/yyyyyy” where xx is the first byte in hex and yyyyyy is the remaining bytes in hex.
§Returns
A string in object pathname format.
Sourcefn to_object_dir(&self) -> String
fn to_object_dir(&self) -> String
Convert the hash value to an object directory name.
Returns just the first byte of the hash as a two-character hex string.
§Returns
A string representing the directory name.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.