pub struct MigratableBlock {
pub header: BlockHeader,
pub data: Vec<u8>,
}Expand description
Complete block with header and data
Fields§
§header: BlockHeader§data: Vec<u8>Implementations§
Source§impl MigratableBlock
impl MigratableBlock
Sourcepub fn new(
data: Vec<u8>,
compression: BlockCompression,
original_size: u32,
compressed_size: u32,
checksum: u32,
) -> Self
pub fn new( data: Vec<u8>, compression: BlockCompression, original_size: u32, compressed_size: u32, checksum: u32, ) -> Self
Create new block with current format
Sourcepub fn with_flags(self, flags: BlockFlags) -> Self
pub fn with_flags(self, flags: BlockFlags) -> Self
Create with flags
Sourcepub fn from_bytes(buf: &[u8]) -> Result<Self>
pub fn from_bytes(buf: &[u8]) -> Result<Self>
Read block from bytes (auto-detects version)
Sourcepub fn needs_migration(&self) -> bool
pub fn needs_migration(&self) -> bool
Check if migration needed
Sourcepub fn verify_checksum(&self) -> Result<()>
pub fn verify_checksum(&self) -> Result<()>
Verify checksum
Trait Implementations§
Source§impl Clone for MigratableBlock
impl Clone for MigratableBlock
Source§fn clone(&self) -> MigratableBlock
fn clone(&self) -> MigratableBlock
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 MigratableBlock
impl RefUnwindSafe for MigratableBlock
impl Send for MigratableBlock
impl Sync for MigratableBlock
impl Unpin for MigratableBlock
impl UnwindSafe for MigratableBlock
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