pub struct TestCommunicationBackend {
outgoing_tx: Sender<OutgoingMessage>,
outgoing_rx: Receiver<OutgoingMessage>,
outgoing: Arc<RwLock<Vec<OutgoingMessage>>>,
incoming_tx: Sender<IncomingMessage>,
incoming_rx: Receiver<IncomingMessage>,
}Expand description
A test implementation of the CommunicationBackend trait. Provides methods to inject
incoming messages and inspect outgoing messages.
Fields§
§outgoing_tx: Sender<OutgoingMessage>§outgoing_rx: Receiver<OutgoingMessage>§outgoing: Arc<RwLock<Vec<OutgoingMessage>>>§incoming_tx: Sender<IncomingMessage>§incoming_rx: Receiver<IncomingMessage>Implementations§
Source§impl TestCommunicationBackend
impl TestCommunicationBackend
Sourcepub fn push_incoming(&self, message: IncomingMessage)
pub fn push_incoming(&self, message: IncomingMessage)
Inject a message as if it were received from a remote endpoint.
Sourcepub async fn outgoing(&self) -> Vec<OutgoingMessage>
pub async fn outgoing(&self) -> Vec<OutgoingMessage>
Get a copy of all the outgoing messages that have been sent.
Sourcepub async fn drain_outgoing(&self) -> Vec<OutgoingMessage>
pub async fn drain_outgoing(&self) -> Vec<OutgoingMessage>
Drain all outgoing messages, returning them and clearing the internal buffer.
Trait Implementations§
Source§impl Clone for TestCommunicationBackend
impl Clone for TestCommunicationBackend
Source§impl CommunicationBackend for TestCommunicationBackend
impl CommunicationBackend for TestCommunicationBackend
Source§type Receiver = TestCommunicationBackendReceiver
type Receiver = TestCommunicationBackendReceiver
Receiver type returned by
subscribe.Source§impl Debug for TestCommunicationBackend
impl Debug for TestCommunicationBackend
Auto Trait Implementations§
impl Freeze for TestCommunicationBackend
impl !RefUnwindSafe for TestCommunicationBackend
impl Send for TestCommunicationBackend
impl Sync for TestCommunicationBackend
impl Unpin for TestCommunicationBackend
impl UnsafeUnpin for TestCommunicationBackend
impl !UnwindSafe for TestCommunicationBackend
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
Create a new handle for an Arc value Read more
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
Clone a handle Read more
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Consume a handle, getting back the initial
Arc<> Read more