Struct CborSeqChunkDecoder
pub struct CborSeqChunkDecoder { /* private fields */ }Expand description
Re-exported from cratestack-codec-cbor, where the scanner moved so
server-side byte-stream bindings (WebTransport) share it with this
client. The cratestack_client_rust::CborSeqChunkDecoder path is
unchanged.
Stateful boundary scanner for application/cbor-seq streams. Bytes
arrive in arbitrary chunks; this type buffers them and emits the
byte ranges of any complete top-level CBOR items observed so far.
The CBOR-level parse uses minicbor::Decoder::skip for boundary
detection (cheap, doesn’t allocate); the per-item serde decode
happens at the caller’s leisure on each returned slice.
Exposed publicly so callers that read the bytes themselves — e.g. apps
that run the HTTP request themselves (dio in Flutter, fetch in Wasm,
platform networking on iOS/Android) — can reuse the
boundary-detection logic without re-implementing it.
Implementations§
§impl CborSeqChunkDecoder
impl CborSeqChunkDecoder
pub fn new() -> CborSeqChunkDecoder
pub fn feed_chunk(
&mut self,
chunk: &[u8],
) -> Result<Vec<Vec<u8>>, CratestackError>
pub fn feed_chunk( &mut self, chunk: &[u8], ) -> Result<Vec<Vec<u8>>, CratestackError>
Append chunk to the internal buffer and return the bytes of
every complete top-level CBOR item now in it. Drains those bytes
from the buffer; any trailing bytes that don’t yet form a
complete item stay buffered for the next call.
pub fn pending_len(&self) -> usize
pub fn pending_len(&self) -> usize
Bytes currently buffered (waiting for frame completion). After the upstream stream closes, a non-zero value here indicates a truncated final frame — the server hung up mid-item.
Trait Implementations§
§impl Default for CborSeqChunkDecoder
impl Default for CborSeqChunkDecoder
§fn default() -> CborSeqChunkDecoder
fn default() -> CborSeqChunkDecoder
Auto Trait Implementations§
impl Freeze for CborSeqChunkDecoder
impl RefUnwindSafe for CborSeqChunkDecoder
impl Send for CborSeqChunkDecoder
impl Sync for CborSeqChunkDecoder
impl Unpin for CborSeqChunkDecoder
impl UnsafeUnpin for CborSeqChunkDecoder
impl UnwindSafe for CborSeqChunkDecoder
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<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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