[−][src]Struct broadcaster::BroadcastChannel
A broadcast channel, wrapping any clonable Stream and Sink to have every message sent to every receiver.
Methods
impl<T: Send + Clone> BroadcastChannel<T>
[src]
impl<T: Send + Clone> BroadcastChannel<T, Sender<T>, Receiver<T>>
[src]
pub fn with_cap(cap: usize) -> Self
[src]
Create a new bounded channel with a specific capacity. Requires the default-channels
feature.
pub fn try_send(&self, item: &T) -> Result<(), TrySendError<T>>
[src]
Try sending a value on a bounded channel. Requires the default-channels
feature.
impl<T, S, R> BroadcastChannel<T, S, R> where
T: Send + Clone + 'static,
S: Send + Sync + Unpin + Clone + Sink<T>,
R: Unpin + Stream<Item = T>,
[src]
T: Send + Clone + 'static,
S: Send + Sync + Unpin + Clone + Sink<T>,
R: Unpin + Stream<Item = T>,
pub fn with_ctor(ctor: Arc<dyn Fn() -> (S, R) + Send + Sync>) -> Self
[src]
Construct a new channel from any Sink and Stream. For proper functionality, cloning a Sender will create a new sink that also sends data to Receiver.
pub async fn send<'_, '_>(&'_ self, item: &'_ T) -> Result<(), S::Error>
[src]
Send an item to all receivers in the channel, including this one. This is because futures-channel does not support comparing a sender and receiver. If this is not the desired behavior, you must handle it yourself.
pub fn recv(&mut self) -> impl Future<Output = Option<T>> + '_
[src]
Receive a single value from the channel.
Trait Implementations
impl<T, S, R> Drop for BroadcastChannel<T, S, R> where
T: Send + Clone + 'static,
S: Send + Sync + Unpin + Clone + Sink<T>,
R: Unpin + Stream<Item = T>,
[src]
T: Send + Clone + 'static,
S: Send + Sync + Unpin + Clone + Sink<T>,
R: Unpin + Stream<Item = T>,
impl<T, S, R> Clone for BroadcastChannel<T, S, R> where
T: Send + Clone + 'static,
S: Send + Sync + Unpin + Clone + Sink<T>,
R: Unpin + Stream<Item = T>,
[src]
T: Send + Clone + 'static,
S: Send + Sync + Unpin + Clone + Sink<T>,
R: Unpin + Stream<Item = T>,
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T, S, R> Debug for BroadcastChannel<T, S, R> where
T: Send + Clone + 'static,
S: Send + Sync + Unpin + Clone + Debug + Sink<T>,
R: Unpin + Debug + Stream<Item = T>,
[src]
T: Send + Clone + 'static,
S: Send + Sync + Unpin + Clone + Debug + Sink<T>,
R: Unpin + Debug + Stream<Item = T>,
Auto Trait Implementations
impl<T, S, R> Send for BroadcastChannel<T, S, R> where
R: Send,
R: Send,
impl<T, S, R> Unpin for BroadcastChannel<T, S, R>
impl<T, S, R> Sync for BroadcastChannel<T, S, R> where
R: Sync,
R: Sync,
impl<T, S = UnboundedSender<T>, R = UnboundedReceiver<T>> !UnwindSafe for BroadcastChannel<T, S, R>
impl<T, S = UnboundedSender<T>, R = UnboundedReceiver<T>> !RefUnwindSafe for BroadcastChannel<T, S, R>
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,