Struct box_stream::BoxWriter
[−]
[src]
pub struct BoxWriter<W: Write> { /* fields omitted */ }
Wraps a writer, encrypting all writes.
Methods
impl<W: Write> BoxWriter<W>
[src]
fn new(inner: W, key: Key, nonce: Nonce) -> BoxWriter<W>
Create a new writer, wrapping inner
and using key
and nonce
for
encryption.
fn get_ref(&self) -> &W
Gets a reference to the underlying writer.
fn get_mut(&mut self) -> &mut W
Gets a mutable reference to the underlying writer.
It is inadvisable to directly write to the underlying writer.
fn into_inner(self) -> W
Unwraps this BoxWriter
, returning the underlying writer.
fn write_final_header(&mut self) -> Result<()>
Tries to write a final header, indicating the end of the connection. This will flush all internally buffered data before writing the header.
After this has returned Ok(())
, no further methods of the BoxWriter
may be called.
If this returns an error, it may be safely called again. Only once this
returns Ok(())
the final header is guaranteed to have been written.
Trait Implementations
impl<W: Write> Write for BoxWriter<W>
[src]
fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this object, returning how many bytes were written. Read more
fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
1.0.0
Attempts to write an entire buffer into this write. Read more
fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
1.0.0
Writes a formatted string into this writer, returning any error encountered. Read more
fn by_ref(&mut self) -> &mut Self
1.0.0
Creates a "by reference" adaptor for this instance of Write
. Read more
impl<AW: AsyncWrite> AsyncWrite for BoxWriter<AW>
[src]
fn shutdown(&mut self) -> Poll<(), Error>
Initiates or attempts to shut down this writer, returning success when the I/O connection has completely shut down. Read more
fn write_buf<B>(&mut self, buf: &mut B) -> Result<Async<usize>, Error> where
B: Buf,
B: Buf,
Write a Buf
into this value, returning how many bytes were written. Read more