[][src]Struct savefile::CryptoWriter

pub struct CryptoWriter<'a> { /* fields omitted */ }

A cryptographic stream wrapper. Wraps a plain dyn Write, and itself implements Write, encrypting all data written.

Implementations

impl<'a> CryptoWriter<'a>[src]

pub fn new(
    writer: &'a mut dyn Write,
    key_bytes: [u8; 32]
) -> Result<CryptoWriter<'a>, SavefileError>
[src]

Create a new CryptoWriter, wrapping the given Write . Encrypts using the given 32 byte cryptographic key. Crypto is 256 bit AES GCM

pub fn flush_final(self) -> Result<(), SavefileError>[src]

Data is encrypted in chunks. Calling this unconditionally finalizes a chunk, actually emitting data to the underlying dyn Write. When later reading data, an entire chunk must be read from file before any plaintext is produced.

Trait Implementations

impl<'a> Drop for CryptoWriter<'a>[src]

impl<'a> Write for CryptoWriter<'a>[src]

fn flush(&mut self) -> Result<(), Error>[src]

Writes any non-written buffered bytes to the underlying stream. If this fails, there is no recovery. The buffered data will have been lost.

Auto Trait Implementations

impl<'a> !RefUnwindSafe for CryptoWriter<'a>

impl<'a> !Send for CryptoWriter<'a>

impl<'a> !Sync for CryptoWriter<'a>

impl<'a> Unpin for CryptoWriter<'a>

impl<'a> !UnwindSafe for CryptoWriter<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<W> WriteBytesExt for W where
    W: Write + ?Sized
[src]