pub struct Bus<T: Clone + Sync> { /* fields omitted */ }
A bus which buffers messages for all of its readers
to eventually read. Allows the dynamic addition and
removal of readers.
Create a new Bus
that will buffer at most len
messages.
Note that until all readers have read a given message
(or the reader has been dropped) it is kept in the
buffer and counts against the buffer size.
Create a new BusReader
instance which can be used to
read messages from the Bus
that were sent after the
creation of this BusReader
.
Attempt to broadcast a message synchronously, failing and
returning the item set to be broadcast if the broadcast
cannot be completed without blocking.
It can be inconvient in some cases to have to deal with
the Sink
trait as it necessarily needs to take and pass
back ownership. The Bus
does not need any blocking I/O
except when the buffer is full, which in some systems is
an easy situation to avoid.
This method will allow for synchronous sending while still
allowing asynchronous readers to be woken up to read.
Make readers aware of the Bus dropping in
order to let them terminate their Stream
.
The type of value that the sink accepts.
The type of value produced by the sink when an error occurs.
Either successfully buffer the item on the internal
Bus' buffer, or indicate the Sink is full.
This sink uses the inner Bus' buffer and therefore a
success with start_send
has already completed the send
A method to indicate that no more values will ever be pushed into this sink. Read more
Creates a new object which will produce a synchronous sink. Read more
Composes a function in front of the sink. Read more
Composes a function in front of the sink. Read more
Transforms the error returned by the sink.
Map this sink's error to any error implementing From
for this sink's Error
, returning a new sink. Read more
Adds a fixed-size buffer to the current sink. Read more
A future that completes when the sink has finished processing all pending requests. Read more
A future that completes after the given item has been fully processed into the sink, including flushing. Read more
A future that completes after the given stream has been fully processed into the sink, including flushing. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)