pub struct InMemoryChannel { /* private fields */ }Expand description
In-process CommandChannel backed by unbounded futures MPSC
queues. Useful for tests and for wiring multiple registries running
inside a single process (e.g. across async tasks or worker threads).
Implementations§
Source§impl InMemoryChannel
impl InMemoryChannel
Sourcepub fn pair(
id_a: impl Into<String>,
id_b: impl Into<String>,
) -> (Arc<Self>, Arc<Self>)
pub fn pair( id_a: impl Into<String>, id_b: impl Into<String>, ) -> (Arc<Self>, Arc<Self>)
Returns two channels wired to each other. A message sent on one
arrives on the other’s recv.
Each half carries a label, since the registry uses it as the
routing key. The two halves typically use each other’s labels:
the parent calls the child channel "child" and vice versa.
Trait Implementations§
Source§impl CommandChannel for InMemoryChannel
impl CommandChannel for InMemoryChannel
Source§fn start(&self) -> BoxFuture<'_, Result<(), ChannelError>>
fn start(&self) -> BoxFuture<'_, Result<(), ChannelError>>
Performs any connection/handshake setup. Called once by the
registry before the first recv.
Source§fn close(&self) -> BoxFuture<'_, ()>
fn close(&self) -> BoxFuture<'_, ()>
Releases any resources and signals the peer that the channel is
going away. After
close, send must return Err(Closed) and
recv must return None.Auto Trait Implementations§
impl !Freeze for InMemoryChannel
impl !RefUnwindSafe for InMemoryChannel
impl Send for InMemoryChannel
impl Sync for InMemoryChannel
impl Unpin for InMemoryChannel
impl UnsafeUnpin for InMemoryChannel
impl !UnwindSafe for InMemoryChannel
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