Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Implement default for EventBroker
Browse files Browse the repository at this point in the history
  • Loading branch information
Garry O'Donnell committed May 7, 2024
1 parent d15a906 commit d829623
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions backend/graphql_event_broker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ use tokio_stream::wrappers::BroadcastStream;
#[derive(Debug)]
pub struct EventBroker<E, const CAPACITY: usize = 1024>(Lazy<Sender<E>>);

impl<E: Clone + Send + 'static, const CAPACITY: usize> Default for EventBroker<E, CAPACITY> {
fn default() -> Self {
Self::new()
}
}

impl<E: Clone + Send + 'static, const CAPACITY: usize> EventBroker<E, CAPACITY> {
/// Constructs an [`EventBroker`], creation of the underlying channel is performed at first use.
pub const fn new() -> Self {
Expand Down

0 comments on commit d829623

Please sign in to comment.