ciborium icon indicating copy to clipboard operation
ciborium copied to clipboard

[Feature]: Expose Serializer and Deserializer as pub?

Open timClicks opened this issue 3 years ago • 3 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Description

I would like to add CBOR support to a data conversion utility that I've created, which makes use of serde. To do so, I would preferably like to access Deserializer and Serializer directly, rather than through helper methods.

Acceptance Criteria

Ability to use ciborium::{Serializer, Deserializer} from other crates.

Suggestions for a technical implementation

No response

timClicks avatar Nov 20 '22 07:11 timClicks

I think this is something that you really need before you claim that you have Serde support. If you don't provide a public Serializer/Deserializer struct implementing those traits it really restricts the ability to efficiently implement custom conversions on top of it (such as using the Visitor pattern with deserialize_any).

brusshamilton avatar Apr 11 '23 22:04 brusshamilton

+1, ciborium is likely taking an unnecessary hit in my rust_serialization_benchmarks because it only exposes an API for ciborium_io::Read/Write types. All of the input/output buffers are available as contiguous slices, and readers and writers add significant overhead. Compare ciborium vs cbor on the log benchmark:

Crate Serialize Deserialize Size Zlib Zstd
cbor 2.2871 ms 7.6305 ms 1407835 407372 324081
ciborium 4.3776 ms 12.279 ms 1407835 407372 324081

A more efficient API surface could be free performance!

djkoloski avatar May 08 '23 04:05 djkoloski

This is more or less a duplicate of #18

LevitatingBusinessMan avatar Jun 01 '23 01:06 LevitatingBusinessMan