pub enum BlockHeader {
V1(V1Header),
V2(V2Header),
}Expand description
Version-agnostic block header
Variants§
Implementations§
Source§impl BlockHeader
impl BlockHeader
Sourcepub fn from_bytes(buf: &[u8]) -> Result<Self>
pub fn from_bytes(buf: &[u8]) -> Result<Self>
Detect version and parse header from bytes
Sourcepub fn version(&self) -> FormatVersion
pub fn version(&self) -> FormatVersion
Get the format version
Sourcepub fn header_size(&self) -> usize
pub fn header_size(&self) -> usize
Get header size
Sourcepub fn compression(&self) -> BlockCompression
pub fn compression(&self) -> BlockCompression
Get compression type
Sourcepub fn original_size(&self) -> u32
pub fn original_size(&self) -> u32
Get original (uncompressed) size
Sourcepub fn compressed_size(&self) -> u32
pub fn compressed_size(&self) -> u32
Get compressed size
Sourcepub fn flags(&self) -> BlockFlags
pub fn flags(&self) -> BlockFlags
Get flags (V2 only, returns default for V1)
Sourcepub fn is_current(&self) -> bool
pub fn is_current(&self) -> bool
Check if this is the current format version
Sourcepub fn needs_migration(&self) -> bool
pub fn needs_migration(&self) -> bool
Check if block needs migration
Trait Implementations§
Source§impl Clone for BlockHeader
impl Clone for BlockHeader
Source§fn clone(&self) -> BlockHeader
fn clone(&self) -> BlockHeader
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for BlockHeader
impl RefUnwindSafe for BlockHeader
impl Send for BlockHeader
impl Sync for BlockHeader
impl Unpin for BlockHeader
impl UnsafeUnpin for BlockHeader
impl UnwindSafe for BlockHeader
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