Struct ReadHalf

Source
pub struct ReadHalf<T, U> { /* private fields */ }
Expand description

Async Encryption Read Half

Implementations§

Source§

impl<T, A, S> ReadHalf<T, Decryptor<A, S>>

Source

pub fn new(inner: T, decryptor: Decryptor<A, S>) -> Self

Source

pub fn with_capacity(inner: T, decryptor: Decryptor<A, S>, size: usize) -> Self

Source

pub fn buffer(&self) -> &[u8]

Return the contents of the internal buffer at the current position, for diagnostic purposes.

For each message available in the buffer, the first 4 bytes are the message length encoded as a little endian u32. The end of the buffer may contain incomplete data.

Trait Implementations§

Source§

impl<R: AsyncRead, A, S> AsyncBufRead for ReadHalf<R, Decryptor<A, S>>

Source§

fn poll_fill_buf( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<&[u8]>>

Attempts to return the contents of the internal buffer, filling it with more data from the inner reader if it is empty. Read more
Source§

fn consume(self: Pin<&mut Self>, amt: usize)

Tells this buffer that amt bytes have been consumed from the buffer, so they should no longer be returned in calls to poll_read. Read more
Source§

impl<T, A, S> AsyncRead for ReadHalf<T, Decryptor<A, S>>

Source§

fn poll_read( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut ReadBuf<'_>, ) -> Poll<Result<()>>

The poll read simply tries to produce a value from the internal buffer. If no value is produced, it then tries to poll more bytes from the inner reader

This function may return a std::io::ErrorKind::InvalidData if it is not possible to decrypt the message, in this case, further read attempts will always produce the same error.

Source§

impl<'__pin, T, U> Unpin for ReadHalf<T, U>
where PinnedFieldsOf<__Origin<'__pin, T, U>>: Unpin,

Auto Trait Implementations§

§

impl<T, U> Freeze for ReadHalf<T, U>
where T: Freeze, U: Freeze,

§

impl<T, U> RefUnwindSafe for ReadHalf<T, U>

§

impl<T, U> Send for ReadHalf<T, U>
where T: Send, U: Send,

§

impl<T, U> Sync for ReadHalf<T, U>
where T: Sync, U: Sync,

§

impl<T, U> UnwindSafe for ReadHalf<T, U>
where T: UnwindSafe, U: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.