Skip to content

Commit 6702a36

Browse files
committed
no_std #1
Signed-off-by: [email protected] <[email protected]>
1 parent 364ad7b commit 6702a36

21 files changed

+399
-0
lines changed

.history/src/lib_20201107132414.rs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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};

.history/src/lib_20201107132439.rs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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+
#![doc(html_root_url = "https://docs.rs/cloudevents-sdk/0.3.0")]
41+
#![deny(broken_intra_doc_links)]
42+
#![no_std]
43+
44+
extern crate no_std_compat as std;
45+
46+
extern crate serde;
47+
extern crate serde_json;
48+
extern crate serde_value;
49+
extern crate snafu;
50+
51+
pub mod event;
52+
pub mod message;
53+
54+
pub use event::Data;
55+
pub use event::Event;
56+
pub use event::{AttributesReader, AttributesWriter};
57+
pub use event::{EventBuilder, EventBuilderV03, EventBuilderV10};

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ base64 = "^0.12"
2525
url = { version = "^2.1", features = ["serde"] }
2626
snafu = "^0.6"
2727
bitflags = "^1.2"
28+
no-std-compat = { version = "^0.4.1", features = ["alloc"] }
2829

2930
[target."cfg(not(target_arch = \"wasm32\"))".dependencies]
3031
hostname = "^0.3"

src/event/attributes.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use super::{
55
use chrono::{DateTime, Utc};
66
use serde::Serializer;
77
use std::fmt;
8+
use std::prelude::v1::*;
89
use url::Url;
910

1011
/// Enum representing a borrowed value of a CloudEvent attribute.

src/event/data.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use serde_json::Value;
22
use std::convert::TryFrom;
33
use std::fmt;
44
use std::fmt::Formatter;
5+
use std::prelude::v1::*;
56

67
/// Event [data attribute](https://github.com/cloudevents/spec/blob/master/spec.md#event-data) representation
78
#[derive(PartialEq, Eq, Debug, Clone)]

0 commit comments

Comments
 (0)