pub struct MainHeader { /* private fields */ }Expand description
The main header is the first Header, which can be found at the beginning of the first segment.
This header contains a lot of metadata about the zff container
- the target chunk size: the size of the chunks in which the original data was read.
- the target segment size
- a unique identifier, written to each segment header: With this identifier you can uniquely assign the corresponding segments that belong together: there may be cases where you don’t want to or can’t do this via the file names.
Implementations§
Source§impl MainHeader
impl MainHeader
Sourcepub fn new(
version: u8,
chunk_size: u8,
segment_size: u64,
unique_identifier: i64,
) -> MainHeader
pub fn new( version: u8, chunk_size: u8, segment_size: u64, unique_identifier: i64, ) -> MainHeader
returns a new main header with the given values.
Sourcepub fn chunk_size(&self) -> usize
pub fn chunk_size(&self) -> usize
returns the chunk_size.
Sourcepub fn segment_size(&self) -> u64
pub fn segment_size(&self) -> u64
returns the segment size
Sourcepub fn get_encoded_size(&self) -> usize
pub fn get_encoded_size(&self) -> usize
returns the len() of the Vec<u8> (encoded main header).
Sourcepub fn unique_identifier(&self) -> i64
pub fn unique_identifier(&self) -> i64
returns the unique identifier
Trait Implementations§
Source§impl Clone for MainHeader
impl Clone for MainHeader
Source§fn clone(&self) -> MainHeader
fn clone(&self) -> MainHeader
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 moreSource§impl Debug for MainHeader
impl Debug for MainHeader
Source§impl HeaderCoding for MainHeader
impl HeaderCoding for MainHeader
Source§type Item = MainHeader
type Item = MainHeader
the return value for decode_content(), decode_directly(), decode_for_key();
Source§fn identifier() -> u32
fn identifier() -> u32
returns the identifier (=Magic bytes) of the header.
Source§fn decode_content(data: Vec<u8>) -> Result<MainHeader>
fn decode_content(data: Vec<u8>) -> Result<MainHeader>
decodes the content of the header.
Source§fn header_size(&self) -> usize
fn header_size(&self) -> usize
returns the size of the encoded header (in bytes)
Source§fn encode_directly(&self) -> Vec<u8> ⓘ
fn encode_directly(&self) -> Vec<u8> ⓘ
encodes the (header) value/object directly (= without key).
Source§fn encode_for_key<K: Into<String>>(&self, key: K) -> Vec<u8> ⓘ
fn encode_for_key<K: Into<String>>(&self, key: K) -> Vec<u8> ⓘ
encodes a key to the (header) value/object.
Source§fn decode_header_length<R: Read>(data: &mut R) -> Result<u64>
fn decode_header_length<R: Read>(data: &mut R) -> Result<u64>
decodes the length of the header.
Source§fn check_identifier<R: Read>(data: &mut R) -> bool
fn check_identifier<R: Read>(data: &mut R) -> bool
checks if the read identifier is valid for this header.
Auto Trait Implementations§
impl Freeze for MainHeader
impl RefUnwindSafe for MainHeader
impl Send for MainHeader
impl Sync for MainHeader
impl Unpin for MainHeader
impl UnwindSafe for MainHeader
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