pub struct EncryptBufWriter<A, B, W, S>where
A: AeadInPlace,
B: CappedBuffer,
W: Write,
S: StreamPrimitive<A>,
A::NonceSize: Sub<S::NonceOverhead>,
NonceSize<A, S>: ArrayLength<u8>,{ /* private fields */ }Expand description
A wrapper around a Write object and a StreamPrimitive
providing a Write interface which automatically encrypts the underlying stream when
writing
Implementations§
Source§impl<A, B, W, S> EncryptBufWriter<A, B, W, S>where
A: AeadInPlace,
B: CappedBuffer,
W: Write,
S: StreamPrimitive<A>,
A::NonceSize: Sub<S::NonceOverhead>,
NonceSize<A, S>: ArrayLength<u8>,
impl<A, B, W, S> EncryptBufWriter<A, B, W, S>where
A: AeadInPlace,
B: CappedBuffer,
W: Write,
S: StreamPrimitive<A>,
A::NonceSize: Sub<S::NonceOverhead>,
NonceSize<A, S>: ArrayLength<u8>,
Sourcepub fn new(
key: &Key<A>,
nonce: &Nonce<A, S>,
buffer: B,
writer: W,
) -> Result<Self, InvalidCapacity>
pub fn new( key: &Key<A>, nonce: &Nonce<A, S>, buffer: B, writer: W, ) -> Result<Self, InvalidCapacity>
Constructs a new Writer using an AEAD key, buffer and reader
Sourcepub fn from_aead(
aead: A,
nonce: &Nonce<A, S>,
buffer: B,
writer: W,
) -> Result<Self, InvalidCapacity>
pub fn from_aead( aead: A, nonce: &Nonce<A, S>, buffer: B, writer: W, ) -> Result<Self, InvalidCapacity>
Constructs a new Writer using an AEAD primitive, buffer and reader
Sourcepub fn into_inner(self) -> Result<W, IntoInnerError<Self, W::Error>>
pub fn into_inner(self) -> Result<W, IntoInnerError<Self, W::Error>>
Consumes the Writer and returns the inner writer
Trait Implementations§
Source§impl<A, B, W, S> Drop for EncryptBufWriter<A, B, W, S>where
A: AeadInPlace,
B: CappedBuffer,
W: Write,
S: StreamPrimitive<A>,
A::NonceSize: Sub<S::NonceOverhead>,
NonceSize<A, S>: ArrayLength<u8>,
impl<A, B, W, S> Drop for EncryptBufWriter<A, B, W, S>where
A: AeadInPlace,
B: CappedBuffer,
W: Write,
S: StreamPrimitive<A>,
A::NonceSize: Sub<S::NonceOverhead>,
NonceSize<A, S>: ArrayLength<u8>,
Source§impl<A, B, W, S> Write for EncryptBufWriter<A, B, W, S>where
A: AeadInPlace,
B: CappedBuffer,
W: Write,
W::Error: Into<Error>,
S: StreamPrimitive<A>,
A::NonceSize: Sub<S::NonceOverhead>,
NonceSize<A, S>: ArrayLength<u8>,
impl<A, B, W, S> Write for EncryptBufWriter<A, B, W, S>where
A: AeadInPlace,
B: CappedBuffer,
W: Write,
W::Error: Into<Error>,
S: StreamPrimitive<A>,
A::NonceSize: Sub<S::NonceOverhead>,
NonceSize<A, S>: ArrayLength<u8>,
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Writes a buffer into this writer, returning how many bytes were written. Read more
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flushes this output stream, ensuring that all intermediately buffered
contents reach their destination. Read more
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this writer. Read more
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
write_all_vectored)Attempts to write multiple buffers into this writer. Read more
Auto Trait Implementations§
impl<A, B, W, S> Freeze for EncryptBufWriter<A, B, W, S>where
<<A as AeadCore>::NonceSize as Sub<<S as StreamPrimitive<A>>::NonceOverhead>>::Output: Sized,
B: Freeze,
W: Freeze,
<<<A as AeadCore>::NonceSize as Sub<<S as StreamPrimitive<A>>::NonceOverhead>>::Output as ArrayLength<u8>>::ArrayType: Freeze,
S: Freeze,
<S as StreamPrimitive<A>>::Counter: Freeze,
impl<A, B, W, S> RefUnwindSafe for EncryptBufWriter<A, B, W, S>where
<<A as AeadCore>::NonceSize as Sub<<S as StreamPrimitive<A>>::NonceOverhead>>::Output: Sized,
B: RefUnwindSafe,
W: RefUnwindSafe,
<<<A as AeadCore>::NonceSize as Sub<<S as StreamPrimitive<A>>::NonceOverhead>>::Output as ArrayLength<u8>>::ArrayType: RefUnwindSafe,
S: RefUnwindSafe,
<S as StreamPrimitive<A>>::Counter: RefUnwindSafe,
impl<A, B, W, S> Send for EncryptBufWriter<A, B, W, S>where
<<A as AeadCore>::NonceSize as Sub<<S as StreamPrimitive<A>>::NonceOverhead>>::Output: Sized,
B: Send,
W: Send,
S: Send,
<S as StreamPrimitive<A>>::Counter: Send,
impl<A, B, W, S> Sync for EncryptBufWriter<A, B, W, S>where
<<A as AeadCore>::NonceSize as Sub<<S as StreamPrimitive<A>>::NonceOverhead>>::Output: Sized,
B: Sync,
W: Sync,
S: Sync,
<S as StreamPrimitive<A>>::Counter: Sync,
impl<A, B, W, S> Unpin for EncryptBufWriter<A, B, W, S>where
<<A as AeadCore>::NonceSize as Sub<<S as StreamPrimitive<A>>::NonceOverhead>>::Output: Sized,
B: Unpin,
W: Unpin,
<<<A as AeadCore>::NonceSize as Sub<<S as StreamPrimitive<A>>::NonceOverhead>>::Output as ArrayLength<u8>>::ArrayType: Unpin,
S: Unpin,
<S as StreamPrimitive<A>>::Counter: Unpin,
impl<A, B, W, S> UnwindSafe for EncryptBufWriter<A, B, W, S>where
<<A as AeadCore>::NonceSize as Sub<<S as StreamPrimitive<A>>::NonceOverhead>>::Output: Sized,
B: UnwindSafe,
W: UnwindSafe,
<<<A as AeadCore>::NonceSize as Sub<<S as StreamPrimitive<A>>::NonceOverhead>>::Output as ArrayLength<u8>>::ArrayType: UnwindSafe,
S: UnwindSafe,
<S as StreamPrimitive<A>>::Counter: UnwindSafe,
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> Write for Twhere
T: Write,
impl<T> Write for Twhere
T: Write,
type Error = Error
Source§fn write(&mut self, buf: &[u8]) -> Result<usize, <T as Write>::Error>
fn write(&mut self, buf: &[u8]) -> Result<usize, <T as Write>::Error>
Write a buffer into this writer, returning how many bytes were written.