Crate circulate[][src]

Expand description

crate version Live Build Status Documentation for main branch

Circulate is a lightweight async PubSub framework. It currently requires tokio.

This project is written for BonsaiDb. However, it’s a general-purpose PubSub implementation that can be utilized in any tokio-based Rust codebase.

let relay = Relay::default();
let subscriber = relay.create_subscriber().await;

subscriber.subscribe_to("some topic").await;

relay.publish("some topic", &AnySerializableType).await?;

let message = subscriber.receiver().recv_async().await?;
println!(
    "Received message on topic {}: {:?}",
    message.topic, 
    message.payload::<AnySerializableType>()?
);

Re-exports

pub use flume;

Structs

A PubSub message.

Manages subscriptions and notifications for PubSub.

A subscriber for Messages published to subscribed topics.