From 39baff07ac44a90f60d166820ed2b9509561d3cb Mon Sep 17 00:00:00 2001 From: JasterV <49537445+JasterV@users.noreply.github.com> Date: Fri, 28 Nov 2025 15:06:47 +0100 Subject: [PATCH] chore: update README & docs --- README.md | 10 +++++++++- src/lib.rs | 5 ++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a80f273..8fc2f42 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,14 @@ Designed to be **efficient**, **simple**, and **easy to use**, allowing you to p - **Automatic cleanup**: topics are removed when the last subscriber drops - **Minimal & simple API**: just `EventBus::subscribe` and `EventBus::publish` +## Topic capacity + +The EventBus is build on top of bounded channels, which means that each time a topic is created, we need to specify a capacity. + +The default one is set to an arbitrary value which is available and documented in the docs. + +To know more about how the bounded channels work, check [async_broadcast](https://docs.rs/async-broadcast/0.7.2/async_broadcast/index.html) + --- ## Installation @@ -62,7 +70,7 @@ async fn main() { ## API Overview * `EventBus::new() -> EventBus` – create a new bus -* `EventBus::builder() -> EventBusBuilder` – create a new bus builder +* `EventBus::new_with_topic_capacity() -> EventBus` - create a new but with a configure topic capacity * `EventBus::subscribe(&self, topic: &str) -> Subscription` – subscribe to a topic * `EventBus::publish(&self, topic: &str, data: &[u8]) -> Result<(), PublishError>` – publish a message * `Subscription` implements `futures::Stream>` diff --git a/src/lib.rs b/src/lib.rs index a561631..1a067a0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,7 +7,10 @@ use crate::{ use async_broadcast::{Sender, broadcast}; use std::sync::Arc; -const DEFAULT_TOPIC_CAPACITY: usize = 1000; +/// The default topic capacity, it has been set to this value +/// for no particular reason, it is recommended that users +/// set their preferred value. +pub const DEFAULT_TOPIC_CAPACITY: usize = 1000; mod rc_map; mod subscription;