Skip to content

Refreshed APIs and aligned with Rust conventions

Pre-release
Pre-release
Compare
Choose a tag to compare
@slinkydeveloper slinkydeveloper released this 02 Nov 09:09
d69ab90

On the behalf of CloudEvents community, I'm pleased to announce the 0.3 release of cloudevents/sdk-rust!

Changes to the APIs

This release includes important (breaking) changes, in order to align with the Rust API Guidelines. Below you'll find a non exhaustive list of all the relevant changes.

Event APIs

  • The getters were renamed from get_x to x, following C-GETTER
  • Now all setters returns the previous value of the field
  • Now Data is exported in the main crate
  • Implemented the various std traits Debug, Display, Eq/PartialEq, whenever possible, in public data types
  • Reworked read/write data apis in Event. Now there are no more hidden copies. To read data, you can get a borrow with get_data or the ownership with take_data. To set the data, you can use both set_data or set_data_unchecked and you must manually invoke the conversion from T to event::Data (usually with try_into())
  • set_datacontenttype and set_dataschema now are part of Event public API
  • Removed Data::from_* methods, since they were not really useful and they were confusing

Message APIs

  • Now message::Error is Send and Sync
  • Renamed some variants of message::Error, following G-GOOD-ERR

Integrations

  • Actix-web integration: Renamed RequestExt::into_event to RequestExt::to_event, following C-CONV
  • Actix-web integration: Renamed cloudevents_sdk_actix_web::RequestExt to cloudevents_sdk_actix_web::HttpRequestExt for consistency
  • All integrations: All *Ext trait are now sealed, following C-SEALED

Other changes

  • Actix-web updated to 3.0
  • Now our CI runs the matrix of different supported build targets (glibc/musl/wasm) in each PR and run more lints
  • Now our CI test examples
  • A lot of additions to our docs

For a complete changelog, look at: https://github.com/cloudevents/sdk-rust/milestone/3?closed=1

What's next

In the next releases, we'll focus on improving the stability of the main crate cloudevents-sdk. We're also working on adding support for no_std and we hope to receive new contributions for new integrations!

Huge thanks to all people involved in this release!