Skip to content

[Feature]: Streaming support in ciborium_ll #159

@01mf02

Description

@01mf02

Is there an existing issue for this?

  • I have searched the existing issues

Description

The CBOR RFC specifies that CBOR can be used in streaming applications:

In a streaming application, a data stream may be composed of a sequence of CBOR data items concatenated back-to-back. In such an environment, the decoder immediately begins decoding a new data item if data is found after the end of a previous data item.

I would like to use this in my program jaq, where I have already integrated support for CBOR via ciborium_ll. However, I have hit the limitation that ciborium_ll::Decoder::pull does not allow me to distinguish between EOF and syntax errors. As a result, I have not found a way to properly support CBOR streaming in my application.

Acceptance Criteria

No response

Suggestions for a technical implementation

I see two realistic options:

  • Create a version of Decoder::pull() that returns Option<Result<Header, Error<R::Error>>> instead of Result<Header, Error<R::Error>>. We could call this function next() and then also just implement Iterator for Decoder. :)
  • Enhance the ciborium_ll::Error type with an Eof variant.

If you give me a green light for one of these two options, I would be also motivated to implement this change myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions