MCPcopy Index your code
hub / github.com/cloudevents/sdk-rust

github.com/cloudevents/sdk-rust @0.9.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.9.0 ↗ · + Follow
472 symbols 1,431 edges 74 files 56 documented · 12%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

CloudEvents SDK Rust Crates badge Docs badge

This project implements the CloudEvents Spec for Rust.

Note: This project is WIP under active development, hence all APIs are considered unstable.

Spec support

v0.3 v1.0
CloudEvents Core
AMQP Protocol Binding
AVRO Event Format
HTTP Protocol Binding
JSON Event Format
Kafka Protocol Binding
MQTT Protocol Binding
NATS Protocol Binding
Web hook

Crate Structure

The core modules include definitions for the Event and EventBuilder data structures, JSON serialization rules, and a mechanism to support various Protocol Bindings, each of which is enabled by a specific feature flag:

  • actix: Integration with actix.
  • axum: Integration with axum.
  • warp: Integration with warp.
  • reqwest: Integration with reqwest.
  • rdkafka: Integration with rdkafka.
  • nats: Integration with nats

This crate is continuously tested to work with GNU libc, WASM and musl toolchains.

Get Started

To get started, add the dependency to Cargo.toml, optionally enabling your Protocol Binding of choice:

[dependencies]
cloudevents-sdk = { version = "0.9.0" }

Now you can start creating events:

use cloudevents::{EventBuilder, EventBuilderV10};
use url::Url;

let event = EventBuilderV10::new()
    .id("aaa")
    .source(Url::parse("http://localhost").unwrap())
    .ty("example.demo")
    .build()?;

Checkout the examples using our integrations to learn how to send and receive events:

Community

  • There are bi-weekly calls immediately following the Serverless/CloudEvents call at 9am PT (US Pacific). Which means they will typically start at 10am PT, but if the other call ends early then the SDK call will start early as well. See the CloudEvents meeting minutes to determine which week will have the call.
  • Slack: #cloudeventssdk (or #cloudevents-sdk-rust) channel under CNCF's Slack workspace.
  • Email: https://lists.cncf.io/g/cncf-cloudevents-sdk
  • Contact for additional information: Francesco Guardiani (@slinkydeveloper on slack).

Each SDK may have its own unique processes, tooling and guidelines, common governance related material can be found in the CloudEvents community directory. In particular, in there you will find information concerning how SDK projects are managed, guidelines for how PR reviews and approval, and our Code of Conduct information.

If there is a security concern with one of the CloudEvents specifications, or with one of the project's SDKs, please send an email to cncf-cloudevents-security@lists.cncf.io.

Additional SDK Resources

Extension points exported contracts — how you extend this code

BinarySerializer (Interface)
Serializer for binary mode messages. [7 implementers]
src/message/serializer.rs
AttributesReader (Interface)
Trait to get [CloudEvents Context attributes](https://github.com/cloudevents/spec/blob/master/spec.md#context-attributes [4 …
src/event/attributes.rs
Headers (Interface)
Any http library should be able to use the [`to_event`](super::to_event) function with an implementation of this trait. [2 …
src/binding/http/headers.rs
StructuredDeserializer (Interface)
Deserializer trait for a Message that can be encoded as structured mode. [5 implementers]
src/message/deserializer.rs
AttributesWriter (Interface)
Trait to set [CloudEvents Context attributes](https://github.com/cloudevents/spec/blob/master/spec.md#context-attributes [4 …
src/event/attributes.rs
Sealed (Interface)
Sealing the FutureRecordExt and BaseRecordExt [2 implementers]
src/binding/rdkafka/kafka_producer_record.rs
StructuredSerializer (Interface)
Serializer for structured mode messages. [5 implementers]
src/message/serializer.rs
TryIntoUrl (Interface)
Trait to define conversion to [`Url`] [3 implementers]
src/event/types.rs

Core symbols most depended-on inside this repo

header
called by 75
src/binding/http/builder/adapter.rs
extension
called by 39
src/event/mod.rs
build
called by 36
src/event/v03/builder.rs
header
called by 29
src/binding/actix/server_response.rs
source
called by 27
src/event/v03/builder.rs
ty
called by 25
src/event/v03/builder.rs
id
called by 24
src/event/v03/builder.rs
data
called by 22
src/event/mod.rs

Shape

Method 241
Function 162
Interface 34
Class 24
Enum 11

Languages

Rust100%

Modules by API surface

src/event/mod.rs31 symbols
src/event/attributes.rs28 symbols
src/event/v10/attributes.rs25 symbols
src/event/v03/attributes.rs25 symbols
src/event/message.rs23 symbols
src/event/v10/builder.rs20 symbols
src/event/v03/builder.rs20 symbols
src/binding/reqwest/client_request.rs18 symbols
src/test/fixtures/v10.rs16 symbols
src/test/fixtures/mod.rs14 symbols
src/binding/rdkafka/kafka_producer_record.rs14 symbols
src/binding/rdkafka/kafka_consumer_record.rs12 symbols

For agents

$ claude mcp add sdk-rust \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact