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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more