pub struct FSPrefix {
pub version: u16,
pub meta: FSMetaV1,
}
Expand description
The on-disk first few bytes of the file, consisting of:
- The
FILETAG
- A u16 version
- A u64 length of the
FSMetaV1
- A CRC32 of the
FSMetaV1
- A CRC32 of this prefix (everything from start-of-file to immediately before this point)
After this, the FSMetaV1 can be safely read and validated based on the length and CRC.
Immediately after the FSMetaV1, the payload (if any) is present.
Fields§
§version: u16
§meta: FSMetaV1
Implementations§
Source§impl FSPrefix
impl FSPrefix
pub fn prefixlen() -> usize
Sourcepub fn encode(&self) -> Result<(Bytes, Vec<u8>), Error>
pub fn encode(&self) -> Result<(Bytes, Vec<u8>), Error>
Encodes self, returning the encoded prefix and meta.
You probably want FSPrefix::write
instead.
Trait Implementations§
impl Eq for FSPrefix
impl StructuralPartialEq for FSPrefix
Auto Trait Implementations§
impl Freeze for FSPrefix
impl RefUnwindSafe for FSPrefix
impl Send for FSPrefix
impl Sync for FSPrefix
impl Unpin for FSPrefix
impl UnwindSafe for FSPrefix
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