Struct flo_stream::BlockingPublisher [−][src]
A blocking publisher is a publisher that blocks messages until it has enough subscribers
This is useful for cases where a publisher is being used asynchronously and wants to ensure that its messages are sent to at least one subscriber. Once the required number of subscribers is reached, this will not block again even if some subscribers are dropped.
Implementations
impl<Message: Clone> BlockingPublisher<Message>
[src]
pub fn new(
required_subscribers: usize,
buffer_size: usize
) -> BlockingPublisher<Message>
[src]
required_subscribers: usize,
buffer_size: usize
) -> BlockingPublisher<Message>
Creates a new blocking publisher
This publisher will refuse to receive any items until at least required_subscribers are connected. The buffer size indicates the number of queued items permitted per buffer.
pub fn when_fully_subscribed(
&mut self
) -> impl Future<Output = Result<(), Canceled>> + Send
[src]
&mut self
) -> impl Future<Output = Result<(), Canceled>> + Send
Returns a future that will complete when this publisher has enough subscribers
This is useful as a way to avoid blocking with wait_send
when setting up the publisher
Trait Implementations
impl<Message: 'static + Send + Clone> MessagePublisher for BlockingPublisher<Message>
[src]
type Message = Message
fn subscribe(&mut self) -> Subscriber<Message>
[src]
fn when_ready(&mut self) -> BoxFuture<'static, MessageSender<Message>>
[src]
Reserves a space for a message with the subscribers, returning when it's ready
fn when_empty(&mut self) -> BoxFuture<'static, ()>
[src]
Waits until all subscribers have consumed all pending messages
fn is_closed(&self) -> bool
[src]
Returns true if this publisher is closed (will not publish any further messages to its subscribers)
fn when_closed(&self) -> BoxFuture<'static, ()>
[src]
Future that returns when this publisher is closed
fn publish(&mut self, message: Self::Message) -> BoxFuture<'static, ()>
[src]
Auto Trait Implementations
impl<Message> !RefUnwindSafe for BlockingPublisher<Message>
[src]
impl<Message> Send for BlockingPublisher<Message> where
Message: Send,
[src]
Message: Send,
impl<Message> Sync for BlockingPublisher<Message> where
Message: Send,
[src]
Message: Send,
impl<Message> Unpin for BlockingPublisher<Message>
[src]
impl<Message> !UnwindSafe for BlockingPublisher<Message>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
pub 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>,