Struct workflow_core::channel::Multiplexer
source · pub struct Multiplexer<T>where
T: Clone + Send + Sync + 'static,{
pub channels: Arc<Mutex<HashMap<Id, Sender<T>>>>,
/* private fields */
}Expand description
A simple channel Multiplexer that broadcasts to multiple registered receivers.
Fields§
§channels: Arc<Mutex<HashMap<Id, Sender<T>>>>Implementations§
source§impl<T> Multiplexer<T>where
T: Clone + Send + Sync + 'static,
impl<T> Multiplexer<T>where T: Clone + Send + Sync + 'static,
pub fn new() -> Multiplexer<T>
pub fn register_event_channel(&self) -> (Id, Sender<T>, Receiver<T>)
pub fn unregister_event_channel(&self, id: Id)
pub async fn broadcast(&self, event: T) -> Result<(), ChannelError<T>>
Trait Implementations§
Auto Trait Implementations§
impl<T> RefUnwindSafe for Multiplexer<T>where T: RefUnwindSafe,
impl<T> Send for Multiplexer<T>
impl<T> Sync for Multiplexer<T>
impl<T> Unpin for Multiplexer<T>where T: Unpin,
impl<T> UnwindSafe for Multiplexer<T>where 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