circulate

Crates.iocirculate
lib.rscirculate
version0.5.0
sourcesrc
created_at2021-04-27 02:08:16.999345
updated_at2023-08-24 17:20:19.02943
descriptionLightweight PubSub framework that supports both sync and async
homepage
repositoryhttps://github.com/khonsulabs/circulate
max_upload_size
id389970
size58,585
Publishers (github:khonsulabs:publishers)

documentation

README

Circulate

crate version Live Build Status Documentation for main branch

Circulate is a lightweight PubSub framework that supports both async and non-async code. This project is written for BonsaiDb. While BonsaiDb's async relies upon tokio, this crate is runtime agnostic thanks to the excellent crate flume.

Async Example

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

subscriber.subscribe_to(&"some topic")?;

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

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

Sync Example

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

subscriber.subscribe_to(&"some topic")?;

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

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

Open-source Licenses

This project, like all projects from Khonsu Labs, are open-source. This repository is available under the MIT License or the Apache License 2.0.

To learn more about contributing, please see CONTRIBUTING.md.

Commit count: 12

cargo fmt