Quoting from the README:
Postcard is a #![no_std] focused serializer and deserializer for Serde. Postcard aims to be convenient for developers in constrained environments, while allowing for flexibility to customize behavior as needed.
Postcard released the first stable version, 1.0, in mid-2022. We are now working on a 2.0 release, and are looking for sponsors to make this work possible. If your company uses postcard, and would like to sponsor a portion of this effort, please send us an email!
Postcard is widely used in the embedded Rust ecosystem, but also in projects like ICU4X, bevy, and wasmtime, to efficiently encode and decode data.
Read on for more details about the 2.0 release and the future of postcard
.
Why a breaking change?
In postcard
1.0, I included some non-1.0 dependencies in the public interface, notably
heapless
v0.7. This was intended to make using postcard
in no-std environments easier, but
had the unfortunate side effect of causing problems when heapless
released a breaking v0.8
change. Upgrading heapless in postcard
would be a breaking change, which also makes it
difficult to add implementations for derive traits like MaxSize
and Schema
for both
v0.7 and v0.8.
To be clear - this is not heapless' fault! Crates should make breaking changes when necessary,
and this was an oversight in postcard
to non-conditionally expose these types in the public API.
In postcard
2.0, the plan is to ensure that no third-party crates appear in the public API
by default, and any third-party crates that could be useful (like heapless) to have as helpers
either exist in a separate crate (that can have smaller/less impactful breaking changes), or
specific opt-in features that include version info, like heapless-v0_7
or heapless-v0_8
.
I also plan to clean up and reorganize the public API, fixing some current papercuts, like
the fact that the to_stdvec()
serialization method returns a Result
, even though the
serialization cannot fail, meaning users need to add an unwrap()
even though that function
will never return an Error.
The wire format is NOT changing!
Postcard 1.0 also introduced a stable and specified wire format, meaning users could rely
on the format being portable, consistent, and predictable. Although the library crate
is going to make a breaking change, the wire format is NOT, meaning you can exchange
messages between postcard
1.0 and postcard
2.0 crates, without any loss of compatibility.
This means that even if you upgrade one device/program to postcard
2.0, nothing about the
serialized format will change. For people who use postcard
to talk to a fleet of
microcontrollers: you can upgrade your server to 2.0, while not needing to upgrade any
devices in the field. For people who have postcard
1.0 data stored in a database or cache:
you can upgrade your application to postcard
2.0 without needing to do any re-encoding of
data.
The greater postcard
ecosystem
I'm currently actively working on a number of other crates in the overall postcard
universe,
including crates like postcard-rpc
(a protocol based on the postcard
encoding format), as
well as research around how to do useful things like dynamic decoding of data (for log parsing,
transcoding to JSON, or storing of data into databases), service discovery for embedded devices,
and managed servers for handling communication with multiple embedded devices to make it easier
to write desktop software that talks to microcontrollers effectively.
I'm also looking into non-serde approaches for serialization and deserialization, as an
optional alternative where speed, code size, or support for the postcard
data format in
other languages like C, C++, Python, or Typescript is important; while still being fully
wire-compatible with the current Rust + serde
version of postcard
.
If this research sounds interesting to you, feel free to also send us an email about it!
The postcard
2.0 release will help enable this future functionality, and bring these efforts
closer to THEIR 1.0 release!
Where can I ask questions or make requests for postcard
2.0?
If you have questions, or have something that you'd like that requires a breaking change, feel free to drop by this tracking issue.
How can I sponsor?
I'm primarily looking for companies to sponsor these efforts, in the form of a one time
payment. If you work somewhere that uses postcard
, consider asking if your company can
sponsor these efforts! The 1.0 release could not have happened without the generous
sponsorship of companies like the Mozilla Corporation.
Please send us an email if you have questions, or would like to discuss sponsorship.
Thank you to everyone who uses, contributes, and sponsors the work on postcard
!