pub struct BlockReceiver<const N: usize> { /* private fields */ }Expand description
Reassembles sub-block segments into a bounded buffer of capacity N — used
by the download server and the upload client.
Implementations§
Source§impl<const N: usize> BlockReceiver<N>
impl<const N: usize> BlockReceiver<N>
Sourcepub const fn is_done(&self) -> bool
pub const fn is_done(&self) -> bool
Whether the last segment has been received (then call Self::finish).
Sourcepub fn push(&mut self, segment: &SubSegment<'_>) -> Result<()>
pub fn push(&mut self, segment: &SubSegment<'_>) -> Result<()>
Append a decoded sub-block segment’s seven bytes.
Returns Error::Overflow beyond capacity N, or
Error::UnexpectedCommand if the transfer is already complete.
Sourcepub fn finish(
&mut self,
unused: u8,
crc: u16,
verify_crc: bool,
) -> Result<&[u8]>
pub fn finish( &mut self, unused: u8, crc: u16, verify_crc: bool, ) -> Result<&[u8]>
Finalise: trim the unused tail bytes of the last segment and, when
verify_crc, check the transfer CRC. Returns the reassembled data.
Returns Error::BadLength if unused exceeds the buffer, or
Error::CrcMismatch on a CRC failure.
Trait Implementations§
Source§impl<const N: usize> Debug for BlockReceiver<N>
impl<const N: usize> Debug for BlockReceiver<N>
Auto Trait Implementations§
impl<const N: usize> Freeze for BlockReceiver<N>
impl<const N: usize> RefUnwindSafe for BlockReceiver<N>
impl<const N: usize> Send for BlockReceiver<N>
impl<const N: usize> Sync for BlockReceiver<N>
impl<const N: usize> Unpin for BlockReceiver<N>
impl<const N: usize> UnsafeUnpin for BlockReceiver<N>
impl<const N: usize> UnwindSafe for BlockReceiver<N>
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