HeaderCoding

Trait HeaderCoding 

Source
pub trait HeaderCoding {
    type Item;

Show 13 methods // Required methods fn identifier() -> u32; fn encode_header(&self) -> Vec<u8> ; fn version(&self) -> u8; fn decode_content(data: Vec<u8>) -> Result<Self::Item>; // Provided methods fn header_size(&self) -> usize { ... } fn encode_key<K: Into<String>>(key: K) -> Vec<u8> { ... } fn encode_directly(&self) -> Vec<u8> { ... } fn encode_for_key<K: Into<String>>(&self, key: K) -> Vec<u8> { ... } fn decode_header_length<R: Read>(data: &mut R) -> Result<u64> { ... } fn check_identifier<R: Read>(data: &mut R) -> bool { ... } fn check_key_on_position<K: Into<String>, R: Read>( data: &mut R, key: K, ) -> bool { ... } fn decode_directly<R: Read>(data: &mut R) -> Result<Self::Item> { ... } fn decode_for_key<K: Into<String>, R: Read>( data: &mut R, key: K, ) -> Result<Self::Item> { ... }
}
Expand description

The HeaderCoding trait specifies an interface for the common header methods and the encoding and decoding methods.

Required Associated Types§

Source

type Item

the return value for decode_content(), decode_directly(), decode_for_key();

Required Methods§

Source

fn identifier() -> u32

returns the identifier (=Magic bytes) of the header.

Source

fn encode_header(&self) -> Vec<u8>

encodes the header.

Source

fn version(&self) -> u8

returns the version of the header.

Source

fn decode_content(data: Vec<u8>) -> Result<Self::Item>

decodes the content of the header.

Provided Methods§

Source

fn header_size(&self) -> usize

returns the size of the encoded header (in bytes)

Source

fn encode_key<K: Into<String>>(key: K) -> Vec<u8>

encodes a given key.

Source

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>

encodes a key to the (header) value/object.

Source

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

checks if the read identifier is valid for this header.

Source

fn check_key_on_position<K: Into<String>, R: Read>(data: &mut R, key: K) -> bool

helper method to check, if the key is on position.

Source

fn decode_directly<R: Read>(data: &mut R) -> Result<Self::Item>

decodes the header directly.

Source

fn decode_for_key<K: Into<String>, R: Read>( data: &mut R, key: K, ) -> Result<Self::Item>

decodes the header for the given key.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl HeaderCoding for FileFooter

Source§

impl HeaderCoding for MainFooter

Source§

impl HeaderCoding for ObjectFooterLogical

Source§

impl HeaderCoding for ObjectFooterPhysical

Source§

impl HeaderCoding for zff::footer::SegmentFooter

Source§

impl HeaderCoding for zff::footer::version1::SegmentFooter

Source§

impl HeaderCoding for ChunkHeader

Source§

impl HeaderCoding for CompressionHeader

Source§

impl HeaderCoding for zff::header::DescriptionHeader

Source§

impl HeaderCoding for zff::header::EncryptionHeader

Source§

impl HeaderCoding for FileHeader

Source§

impl HeaderCoding for zff::header::HashHeader

Source§

impl HeaderCoding for zff::header::HashValue

Source§

impl HeaderCoding for zff::header::MainHeader

Source§

impl HeaderCoding for ObjectHeader

Source§

impl HeaderCoding for zff::header::PBEHeader

Source§

impl HeaderCoding for zff::header::PBKDF2SHA256Parameters

Source§

impl HeaderCoding for ScryptParameters

Source§

impl HeaderCoding for zff::header::SegmentHeader

Source§

impl HeaderCoding for zff::header::version1::DescriptionHeader

Source§

impl HeaderCoding for zff::header::version1::EncryptionHeader

Source§

impl HeaderCoding for zff::header::version1::HashHeader

Source§

impl HeaderCoding for zff::header::version1::HashValue

Source§

impl HeaderCoding for zff::header::version1::MainHeader

Source§

impl HeaderCoding for zff::header::version1::PBEHeader

Source§

impl HeaderCoding for zff::header::version1::PBKDF2SHA256Parameters

Source§

impl HeaderCoding for zff::header::version1::SegmentHeader