pub struct BlockTemporaryFile<const BYTES: usize> { /* private fields */ }Expand description
A private temporary byte file with a compile-time logical block width of 1 through 16,384 bytes. Each physical block reserves two authenticated ciphertext slots and a one-byte active selector: 1 + 2 * (24 + 2 + 16 + BYTES) bytes. Only the populated prefix is encrypted; its two-byte length and block position are authenticated. An incomplete replacement never overwrites the active slot. Only ciphertext and its public framing reach disk; each file has a fresh random key which exists solely in this owner. Reopened handles share the owner but have independent logical positions. The last handle removes the file. Abrupt process death may leave an encrypted file whose key was never persisted; this is not a durable recovery or anti-replay format.
Implementations§
Source§impl<const BYTES: usize> BlockTemporaryFile<BYTES>
impl<const BYTES: usize> BlockTemporaryFile<BYTES>
Sourcepub fn physical_len_for(logical_length: u64) -> Result<u64>
pub fn physical_len_for(logical_length: u64) -> Result<u64>
Ciphertext file length for a logical length, including both slots and complete block framing. This excludes filesystem allocation metadata.
pub fn new() -> Result<Self>
pub fn new_in(directory: impl AsRef<Path>) -> Result<Self>
pub fn path(&self) -> &Path
pub fn as_file(&self) -> &Self
pub fn as_file_mut(&mut self) -> &mut Self
Sourcepub fn write_all_vectored(&mut self, input: &mut [IoSlice<'_>]) -> Result<()>
pub fn write_all_vectored(&mut self, input: &mut [IoSlice<'_>]) -> Result<()>
Write the complete concatenation of the slices, sharing one authenticated block publication across adjacent fields. Like Write::write_all, an error can leave a written prefix; record owners retain responsibility for rolling back incomplete records.
pub fn reopen(&self) -> Result<Self>
pub fn metadata(&self) -> Result<TemporaryFileMetadata>
pub fn set_len(&self, length: u64) -> Result<()>
Trait Implementations§
Source§impl<const BYTES: usize> Read for BlockTemporaryFile<BYTES>
impl<const BYTES: usize> Read for BlockTemporaryFile<BYTES>
Source§fn read(&mut self, output: &mut [u8]) -> Result<usize>
fn read(&mut self, output: &mut [u8]) -> Result<usize>
1.36.0 · Source§fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
read, except that it reads into a slice of buffers. Read moreSource§fn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
can_vector)1.0.0 · Source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
buf. Read more1.0.0 · Source§fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
buf. Read more1.6.0 · Source§fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
buf. Read moreSource§fn read_buf(&mut self, buf: BorrowedCursor<'_, u8>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_, u8>) -> Result<(), Error>
read_buf)Source§fn read_buf_exact(
&mut self,
cursor: BorrowedCursor<'_, u8>,
) -> Result<(), Error>
fn read_buf_exact( &mut self, cursor: BorrowedCursor<'_, u8>, ) -> Result<(), Error>
read_buf)cursor. Read more1.0.0 · Source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Read. Read more1.0.0 · Source§fn chain<R>(self, next: R) -> Chain<Self, R> ⓘ
fn chain<R>(self, next: R) -> Chain<Self, R> ⓘ
1.0.0 · Source§fn take(self, limit: u64) -> Take<Self> ⓘwhere
Self: Sized,
fn take(self, limit: u64) -> Take<Self> ⓘwhere
Self: Sized,
limit bytes from it. Read moreSource§fn read_array<const N: usize>(&mut self) -> Result<[u8; N], Error>where
Self: Sized,
fn read_array<const N: usize>(&mut self) -> Result<[u8; N], Error>where
Self: Sized,
read_array)Source§impl<const BYTES: usize> Seek for BlockTemporaryFile<BYTES>
impl<const BYTES: usize> Seek for BlockTemporaryFile<BYTES>
Source§fn seek(&mut self, position: SeekFrom) -> Result<u64>
fn seek(&mut self, position: SeekFrom) -> Result<u64>
1.55.0 · Source§fn rewind(&mut self) -> Result<(), Error>
fn rewind(&mut self) -> Result<(), Error>
Source§fn stream_len(&mut self) -> Result<u64, Error>
fn stream_len(&mut self) -> Result<u64, Error>
seek_stream_len)Source§impl<const BYTES: usize> Write for BlockTemporaryFile<BYTES>
impl<const BYTES: usize> Write for BlockTemporaryFile<BYTES>
Source§fn write(&mut self, input: &[u8]) -> Result<usize>
fn write(&mut self, input: &[u8]) -> Result<usize>
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored)