pub struct FileHeader { /* private fields */ }Expand description
Validated cleartext header. It is authenticated by every file chunk.
Implementations§
Source§impl FileHeader
impl FileHeader
Sourcepub fn decode(bytes: &[u8]) -> Result<Self, Error>
pub fn decode(bytes: &[u8]) -> Result<Self, Error>
Decode exactly the 11-byte header, without reading any ciphertext.
Sourcepub fn chunk_count(&self) -> u64
pub fn chunk_count(&self) -> u64
How many chunks follow this header; an empty file has none.
Sourcepub fn encrypted_size(&self) -> Result<u64, Error>
pub fn encrypted_size(&self) -> Result<u64, Error>
Full stored size, refusing an offset that cannot be represented in u64.
Sourcepub fn chunk(&self, index: u64) -> Result<FileChunk, Error>
pub fn chunk(&self, index: u64) -> Result<FileChunk, Error>
The exact storage offset and plaintext length of a particular chunk.
Sourcepub fn chunk_at(&self, position: u64) -> Result<FileChunk, Error>
pub fn chunk_at(&self, position: u64) -> Result<FileChunk, Error>
The chunk whose stored bytes hold the object’s byte position; a
position in the header or past the last chunk has none.
Trait Implementations§
Source§impl Clone for FileHeader
impl Clone for FileHeader
Source§fn clone(&self) -> FileHeader
fn clone(&self) -> FileHeader
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 FileHeader
impl Debug for FileHeader
Source§impl PartialEq for FileHeader
impl PartialEq for FileHeader
impl Copy for FileHeader
impl Eq for FileHeader
impl StructuralPartialEq for FileHeader
Auto Trait Implementations§
impl Freeze for FileHeader
impl RefUnwindSafe for FileHeader
impl Send for FileHeader
impl Sync for FileHeader
impl Unpin for FileHeader
impl UnsafeUnpin for FileHeader
impl UnwindSafe for FileHeader
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more