Struct bao_tree::io::fsm::ResponseDecoderStart
source · pub struct ResponseDecoderStart<R> { /* private fields */ }
Expand description
Response decoder state machine, at the start of a stream
Implementations§
source§impl<'a, R: AsyncRead + Unpin> ResponseDecoderStart<R>
impl<'a, R: AsyncRead + Unpin> ResponseDecoderStart<R>
sourcepub fn new(
hash: Hash,
ranges: ChunkRanges,
block_size: BlockSize,
encoded: R
) -> Self
pub fn new( hash: Hash, ranges: ChunkRanges, block_size: BlockSize, encoded: R ) -> Self
Create a new response decoder state machine, at the start of a stream where you don’t yet know the size.
sourcepub fn finish(self) -> R
pub fn finish(self) -> R
Immediately finish decoding the stream, returning the underlying reader
sourcepub async fn next(
self
) -> Result<(ResponseDecoderReading<R>, u64), StartDecodeError>
pub async fn next( self ) -> Result<(ResponseDecoderReading<R>, u64), StartDecodeError>
Read the size and go into the next state
The only thing that can go wrong here is an io error when reading the size.
sourcepub fn ranges(&self) -> &ChunkRanges
pub fn ranges(&self) -> &ChunkRanges
The ranges we requested
Trait Implementations§
Auto Trait Implementations§
impl<R> RefUnwindSafe for ResponseDecoderStart<R>where
R: RefUnwindSafe,
impl<R> Send for ResponseDecoderStart<R>where
R: Send,
impl<R> Sync for ResponseDecoderStart<R>where
R: Sync,
impl<R> Unpin for ResponseDecoderStart<R>where
R: Unpin,
impl<R> UnwindSafe for ResponseDecoderStart<R>where
R: UnwindSafe,
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