|
| 1 | +//! This crate implements the [CloudEvents](https://cloudevents.io/) Spec for Rust. |
| 2 | +//! |
| 3 | +//! ``` |
| 4 | +//! # use std::error::Error; |
| 5 | +//! # fn main() -> Result<(), Box<dyn Error>> { |
| 6 | +//! use cloudevents::{EventBuilder, AttributesReader, EventBuilderV10}; |
| 7 | +//! use chrono::{Utc, DateTime}; |
| 8 | +//! use url::Url; |
| 9 | +//! |
| 10 | +//! let event = EventBuilderV10::new() |
| 11 | +//! .id("my_event.my_application") |
| 12 | +//! .source("http://localhost:8080") |
| 13 | +//! .ty("example.demo") |
| 14 | +//! .time(Utc::now()) |
| 15 | +//! .build()?; |
| 16 | +//! |
| 17 | +//! println!("CloudEvent Id: {}", event.id()); |
| 18 | +//! match event.time() { |
| 19 | +//! Some(t) => println!("CloudEvent Time: {}", t), |
| 20 | +//! None => println!("CloudEvent Time: None") |
| 21 | +//! } |
| 22 | +//! # Ok(()) |
| 23 | +//! # } |
| 24 | +//! ``` |
| 25 | +//! |
| 26 | +//! This crate includes: |
| 27 | +//! |
| 28 | +//! * The [`Event`] data structure, to represent CloudEvent (version 1.0 and 0.3) |
| 29 | +//! * The [`EventBuilder`] trait and implementations, to create [`Event`] instances |
| 30 | +//! * The implementation of [`serde::Serialize`] and [`serde::Deserialize`] for [`Event`] to serialize/deserialize CloudEvents to/from JSON |
| 31 | +//! * Traits and utilities in [`message`] to implement Protocol Bindings |
| 32 | +//! |
| 33 | +//! If you're looking for Protocol Binding implementations, look at crates: |
| 34 | +//! |
| 35 | +//! * [cloudevents-sdk-actix-web](https://docs.rs/cloudevents-sdk-actix-web): Integration with [Actix Web](https://github.com/actix/actix-web) |
| 36 | +//! * [cloudevents-sdk-reqwest](https://docs.rs/cloudevents-sdk-reqwest): Integration with [reqwest](https://github.com/seanmonstar/reqwest) |
| 37 | +//! * [cloudevents-sdk-rdkafka](https://docs.rs/cloudevents-sdk-rdkafka): Integration with [rdkafka](https://fede1024.github.io/rust-rdkafka) |
| 38 | +//! |
| 39 | +
|
| 40 | +<<<<<<< master |
| 41 | +#![doc(html_root_url = "https://docs.rs/cloudevents-sdk/0.3.0")] |
| 42 | +#![deny(broken_intra_doc_links)] |
| 43 | +======= |
| 44 | +#![no_std] |
| 45 | + |
| 46 | +extern crate no_std_compat as std; |
| 47 | + |
| 48 | +extern crate serde; |
| 49 | +extern crate serde_json; |
| 50 | +extern crate serde_value; |
| 51 | +extern crate snafu; |
| 52 | +>>>>>>> no_std #1 |
| 53 | + |
| 54 | +pub mod event; |
| 55 | +pub mod message; |
| 56 | + |
| 57 | +pub use event::Data; |
| 58 | +pub use event::Event; |
| 59 | +pub use event::{AttributesReader, AttributesWriter}; |
| 60 | +pub use event::{EventBuilder, EventBuilderV03, EventBuilderV10}; |
0 commit comments