Struct sleep_parser::Header [−][src]
pub struct Header { pub file_type: FileType, pub protocol_version: ProtocolVersion, pub entry_size: u16, pub hash_type: HashType, }
Structural representation of 32 byte SLEEP headers.
Fields
file_type: FileType
Type of file.
protocol_version: ProtocolVersion
Version of the SLEEP protocol.
entry_size: u16
Size of each piece of data in the file body.
hash_type: HashType
Algorithm used for hashing the content.
Methods
impl Header
[src]
impl Header
pub fn new(file_type: FileType, entry_size: u16, hash_type: HashType) -> Self
[src]
pub fn new(file_type: FileType, entry_size: u16, hash_type: HashType) -> Self
Create a new Header
.
pub fn from_vec(buffer: &[u8]) -> Result<Header, Error>
[src]
pub fn from_vec(buffer: &[u8]) -> Result<Header, Error>
Parse a 32 byte buffer slice into a valid Header.
pub fn to_vec(&self) -> Vec<u8>
[src]
pub fn to_vec(&self) -> Vec<u8>
Convert a Header
into a Vec<u8>
. Use this to persist a header back to
disk.
pub fn is_bitfield(&self) -> bool
[src]
pub fn is_bitfield(&self) -> bool
Check whether the header is formatted as a .bitfield
.
pub fn is_signatures(&self) -> bool
[src]
pub fn is_signatures(&self) -> bool
Check whether the header is formatted as a .signatures
.
pub fn is_tree(&self) -> bool
[src]
pub fn is_tree(&self) -> bool
Check whether the header is formatted as a .tree
.