Struct box_stream::BoxReader
[−]
[src]
pub struct BoxReader<R> { /* fields omitted */ }
Wraps a reader, decrypting all reads.
Methods
impl<R> BoxReader<R>
[src]
pub fn new(inner: R, key: Key, nonce: Nonce) -> BoxReader<R>
[src]
Create a new reader, wrapping inner
and using key
and nonce
for
decryption.
pub fn get_ref(&self) -> &R
[src]
Gets a reference to the underlying reader.
pub fn get_mut(&mut self) -> &mut R
[src]
Gets a mutable reference to the underlying reader.
It is inadvisable to directly write to the underlying reader.
pub fn into_inner(self) -> R
[src]
Unwraps this BoxReader
, returning the underlying reader.
Trait Implementations
impl<R: AsyncRead> AsyncRead for BoxReader<R>
[src]
fn poll_read(&mut self, cx: &mut Context, buf: &mut [u8]) -> Poll<usize, Error>
[src]
Read bytes from the wrapped reader and decrypt them. End of stream is signalled by
returning Ok(0)
even though this function was passed a buffer of nonzero length.
Errors
In addition to propagating all errors from the wrapped reader, a
BoxReader
produces the following error kinds:
ErrorKind::InvalidData
: If data could not be decrypted, or if a header declares an invalid length. Possible error values areINVALID_LENGTH
,UNAUTHENTICATED_HEADER
,UNAUTHENTICATED_PACKET
.ErrorKind::UnexpectedEof
: If a call to the inner reader returnedOk(0)
although it was given a buffer of nonzero length. This is an error since end of file must be signalled via a special header in a box stream. The error value for this isUNAUTHENTICATED_EOF
.
unsafe fn initializer(&self) -> Initializer
[src]
Determines if this AsyncRead
er can work with buffers of uninitialized memory. Read more
fn poll_vectored_read(
&mut self,
cx: &mut Context,
vec: &mut [&mut IoVec]
) -> Result<Async<usize>, Error>
[src]
&mut self,
cx: &mut Context,
vec: &mut [&mut IoVec]
) -> Result<Async<usize>, Error>
Attempt to read from the AsyncRead
into vec
using vectored IO operations. Read more