#[non_exhaustive]pub struct MetadataBlockRef {
pub signature: [u8; 4],
pub block_number: u64,
}Expand description
A ReFS v3 self-describing metadata-block header: the four-byte block signature plus the block’s own block number.
#[non_exhaustive] so later phases add the checksum descriptor and the four
redundancy block numbers without a breaking change.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.signature: [u8; 4]The four-byte block signature (SUPB/CHKP/MSB+), validated against
the caller’s expected signature.
block_number: u64The block’s own (self-describing) block number, at header offset 0x20.
Implementations§
Source§impl MetadataBlockRef
impl MetadataBlockRef
Sourcepub fn parse(
data: &[u8],
expected: &'static str,
offset: u64,
) -> Result<Self, RefsError>
pub fn parse( data: &[u8], expected: &'static str, offset: u64, ) -> Result<Self, RefsError>
Parse and validate a metadata-block header at the start of data.
expected is the signature the caller requires (e.g. "SUPB"); offset
is the block’s absolute byte position in the image, carried into the
error so a mismatch names what was there and where.
§Errors
RefsError::BadBlockSignatureif the first four bytes are notexpected— the offending bytes and offset are carried in the error.RefsError::Truncatedifdatais shorter than the header fields.
Trait Implementations§
Source§impl Clone for MetadataBlockRef
impl Clone for MetadataBlockRef
Source§impl Debug for MetadataBlockRef
impl Debug for MetadataBlockRef
impl Eq for MetadataBlockRef
Source§impl PartialEq for MetadataBlockRef
impl PartialEq for MetadataBlockRef
impl StructuralPartialEq for MetadataBlockRef
Auto Trait Implementations§
impl Freeze for MetadataBlockRef
impl RefUnwindSafe for MetadataBlockRef
impl Send for MetadataBlockRef
impl Sync for MetadataBlockRef
impl Unpin for MetadataBlockRef
impl UnsafeUnpin for MetadataBlockRef
impl UnwindSafe for MetadataBlockRef
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more