Expand description
sod::MutService implementations to interact with the broadcast bus::Bus.
§Service Impls
BusBroadcasterbroadcasts to abus::Busand blocks until the operation is successful.BusTryBroadcastertries to broadcast to abus::Busand is able to be retried viasod::RetryServicewhen the bus buffer is full.BusReceiverreceives from abus::BusReader, blocking until an element is received.BusTryReceivertries to receive from abus::BusReaderand is able to be retried viasod::RetryServicewhen the bus is empty.
§Example
use sod::MutService;
use sod_bus::{BusBroadcaster, BusReceiver};
let mut broadcaster = BusBroadcaster::with_len(1024);
let mut receiver1 = broadcaster.create_receiver();
let mut receiver2 = broadcaster.create_receiver();
broadcaster.process(1).unwrap();
broadcaster.process(2).unwrap();
broadcaster.process(3).unwrap();
assert_eq!(receiver1.process(()).unwrap(), 1);
assert_eq!(receiver1.process(()).unwrap(), 2);
assert_eq!(receiver1.process(()).unwrap(), 3);
assert_eq!(receiver2.process(()).unwrap(), 1);
assert_eq!(receiver2.process(()).unwrap(), 2);
assert_eq!(receiver2.process(()).unwrap(), 3);Structs§
- BusBroadcaster
- A blocking
sod::MutServicethat broadcasts to an underlyingbus::Bus. - BusReceiver
- A blocking
sod::MutServicethat receives from an underlyingbus::BusReader - BusTry
Broadcaster - A non-blocking
sod::MutServicethat isRetryableand attempts to broadcast to an underlyingbus::Bus. - BusTry
Receiver - A non-blocking
sod::MutServicethat issod::Retryableand receives from an underlyingbus::BusReader