Expand description

An universal eventbus for Rust!

This crate provides a strong-typed asynchronous eventbus implementation.

Get Started

comet-eventbus is async-first-classed. We recommend you to use async API.

Add following code to your Cargo.toml:

comet-eventbus = "0.1"

Example

use comet_eventbus::{Event, Eventbus};

// define your message struct
struct Message {
    content: u8,
}

#[tokio::main]
async fn main() {
    // creat a new eventbus
    let eventbus = Eventbus::new();

    // create topic
    let topic = eventbus.create_topic("my awsome topic").await;

    // post message to a topic
    topic.post_message(Message { content: 0 }).await;
}

Modules

bridgebridge

bridge Eventbus from an external source

Structs

An Event for passing

An EventListener wrapper for Listener

An asynchronous Eventbus to interact with

A Topic wrapper for a TopicKey

Wrapper of bytes represent a Topic

Traits

Event listener

Type Definitions

short hand of event listeners set

short hand of topic to handlers map

Attribute Macros