Crate core_json_embedded_io

Crate core_json_embedded_io 

Source
Expand description

§core-json embedded-io

embedded-io support for core-json.

§Why?

core-json is a core-only JSON deserializer. It is abstract to the reader yet uses its own BytesLike trait in order to maintain zero dependencies. embedded-io is the prominent crate for performing IO operations without std, alloc.

This crate offers adapters so implementors of embedded_io::Read or embedded_io::Seek can be used with core-json.

Note core-json effectively requires BytesLike be efficient to fork (as bytes read from a BytesLike are themselves returned as a BytesLike, letting the implementor delegate the ownership of the underlying bytes within memory). This means the library bounds Clone + Read and not Read for its ReadAdapter. The SeekAdapter also bounds Clone + Seek, not Seek, yet ClonableSeek is provided as a wrapper to efficiently turn any S: Seek into ClonableSeek<S>: Clone + Seek (at the cost of one extra seek operation per each read).

Structs§

ClonableSeek
A wrapper which allows cheaply and safely cloning implementors of Seek.
ReadAdapter
An adapter from embedded_io::Read to core_json::BytesLike.
SeekAdapter
An adapter from embedded_io::Seek to core_json::BytesLike.

Enums§

Error
An error from an adapter.