Struct Header
pub struct Header {
pub version: u16,
}Available on crate feature
alloc only.Expand description
A parsed, supported journal file header.
Fields§
§version: u16The on-disk format version.
Implementations§
§impl Header
impl Header
pub const LEN: usize = 8usize
pub const LEN: usize = 8usize
Byte length of a journal file header: magic(4) || version_be(2) || reserved(2), written once before any frames.
pub const fn current() -> Self
pub const fn current() -> Self
The header this crate writes for new journals.
pub const fn is_current(&self) -> bool
pub const fn is_current(&self) -> bool
Whether this header names the version this crate writes. A file with an older version must be migrated before anything is appended to it.
pub fn encode_to_vec(&self, out: &mut Vec<u8>)
pub fn encode_to_vec(&self, out: &mut Vec<u8>)
Encodes this header into out.
pub fn decode(bytes: &[u8]) -> Result<Self, HeaderError>
pub fn decode(bytes: &[u8]) -> Result<Self, HeaderError>
Decodes the header at the start of bytes.
§Errors
Returns HeaderError on a short, mismatched, or unsupported header.
Trait Implementations§
impl Copy for Header
impl Eq for Header
impl StructuralPartialEq for Header
Auto Trait Implementations§
impl Freeze for Header
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnwindSafe for Header
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