pub struct BdxReader<'a> { /* private fields */ }Expand description
A reader over a BDX transfer - the Receiver side.
Obtained from Exchange::download on the initiating side, or
from BdxUploadResponder::reply on the responding side. read
drives the protocol as needed and copies the next bytes of the transfer into
the caller’s buffer, returning 0 at the end of the transfer. It also
implements embedded_io_async::Read (delegating to the inherent method).
Implementations§
Source§impl<'a> BdxReader<'a>
impl<'a> BdxReader<'a>
Sourcepub fn len(&self) -> Option<u64>
pub fn len(&self) -> Option<u64>
The total length of the transfer in bytes, if the sender committed to a
definite length during negotiation (None for an indefinite transfer).
Sourcepub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>
pub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>
Read the next bytes of the transfer into buf, returning the number of
bytes read. Returns 0 once the whole transfer has been received.
This is also the embedded_io_async::Read implementation; the inherent
method is kept so callers need not import the trait.
Trait Implementations§
Source§impl Read for BdxReader<'_>
impl Read for BdxReader<'_>
Source§async fn read(
&mut self,
buf: &mut [u8],
) -> Result<usize, <BdxReader<'_> as ErrorType>::Error>
async fn read( &mut self, buf: &mut [u8], ) -> Result<usize, <BdxReader<'_> as ErrorType>::Error>
Source§async fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
async fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
buf. Read moreAuto Trait Implementations§
impl<'a> !RefUnwindSafe for BdxReader<'a>
impl<'a> !Send for BdxReader<'a>
impl<'a> !Sync for BdxReader<'a>
impl<'a> !UnwindSafe for BdxReader<'a>
impl<'a> Freeze for BdxReader<'a>
impl<'a> Unpin for BdxReader<'a>
impl<'a> UnsafeUnpin for BdxReader<'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more