pub struct Hub<T> { /* private fields */ }Expand description
Named rooms with fan-out; cheap to clone, all clones share the rooms
Implementations§
Source§impl<T: Clone + Send + 'static> Hub<T>
impl<T: Clone + Send + 'static> Hub<T>
Sourcepub fn new(capacity: usize) -> Self
pub fn new(capacity: usize) -> Self
capacity: messages buffered per room for slow subscribers (at least 1)
Sourcepub fn subscribe(&self, room: &str) -> Subscription<T>
pub fn subscribe(&self, room: &str) -> Subscription<T>
Join room, creating it if needed. Only messages published after this call arrive.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Hub<T>
impl<T> RefUnwindSafe for Hub<T>where
Arc<Shared<T>>: RefUnwindSafe,
impl<T> Send for Hub<T>
impl<T> Sync for Hub<T>
impl<T> Unpin for Hub<T>
impl<T> UnsafeUnpin for Hub<T>where
Arc<Shared<T>>: UnsafeUnpin,
impl<T> UnwindSafe for Hub<T>where
Arc<Shared<T>>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more