pub struct HeaderBinaryV0 {
pub magic_number: [u8; 10],
pub version: [u8; 2],
pub datatype: [u8; 1],
pub name: [u8; 128],
pub created: [u8; 8],
pub edited: [u8; 8],
pub file_name: [u8; 128],
pub buffer_size: [u8; 8],
}Expand description
All values are big endian
Fields§
§magic_number: [u8; 10]u32 Magic number for exact identification of file-format does not exist on processed header
version: [u8; 2]u16 Version indicating which struct to deserialize to (for future)
datatype: [u8; 1]u8 Matched to enum DataType
name: [u8; 128]UTF-8 string with 1024 bits capacity
created: [u8; 8]u64 Create date in seconds after epoch
edited: [u8; 8]u64 Edit date in seconds after epoch
file_name: [u8; 128]UTF-8 string with 1024 bits capacity
buffer_size: [u8; 8]u64 when required, store buffer size for decoding purposes (maybe have buffer size = cypher length when not used?)
Implementations§
Source§impl HeaderBinaryV0
impl HeaderBinaryV0
pub fn to_bytes(&self) -> Vec<u8> ⓘ
Sourcepub fn from_bytes(bytes: &[u8; 1024]) -> Self
pub fn from_bytes(bytes: &[u8; 1024]) -> Self
§Panics
Should never panic
Sourcepub fn from_parameters(
datatype: &DataType,
name: &str,
old_create_date: Option<i64>,
file_name: &str,
buffer_size: u64,
) -> Self
pub fn from_parameters( datatype: &DataType, name: &str, old_create_date: Option<i64>, file_name: &str, buffer_size: u64, ) -> Self
§Panics
Panics when any of the values are too long (see documentation on binary header limits)
Sourcepub fn from_header(header: &HeaderV0) -> Self
pub fn from_header(header: &HeaderV0) -> Self
§Panics
Panics when any of the values are not the correct length
Trait Implementations§
Source§impl Clone for HeaderBinaryV0
impl Clone for HeaderBinaryV0
Source§fn clone(&self) -> HeaderBinaryV0
fn clone(&self) -> HeaderBinaryV0
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 HeaderBinaryV0
impl Debug for HeaderBinaryV0
Source§impl Hash for HeaderBinaryV0
impl Hash for HeaderBinaryV0
Source§impl Ord for HeaderBinaryV0
impl Ord for HeaderBinaryV0
Source§fn cmp(&self, other: &HeaderBinaryV0) -> Ordering
fn cmp(&self, other: &HeaderBinaryV0) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for HeaderBinaryV0
impl PartialEq for HeaderBinaryV0
Source§impl PartialOrd for HeaderBinaryV0
impl PartialOrd for HeaderBinaryV0
impl Eq for HeaderBinaryV0
impl StructuralPartialEq for HeaderBinaryV0
Auto Trait Implementations§
impl Freeze for HeaderBinaryV0
impl RefUnwindSafe for HeaderBinaryV0
impl Send for HeaderBinaryV0
impl Sync for HeaderBinaryV0
impl Unpin for HeaderBinaryV0
impl UnwindSafe for HeaderBinaryV0
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