Plug Emulator into devtools 🎉
This commit is contained in:
parent
16556b51bc
commit
ed528c9c53
4 changed files with 158 additions and 32 deletions
|
|
@ -2,7 +2,7 @@
|
|||
use crate::subscription;
|
||||
use crate::{BoxStream, Executor, MaybeSend};
|
||||
|
||||
use futures::{Sink, channel::mpsc};
|
||||
use futures::{Sink, SinkExt, channel::mpsc};
|
||||
use std::marker::PhantomData;
|
||||
|
||||
/// A batteries-included runtime of commands and subscriptions.
|
||||
|
|
@ -79,6 +79,15 @@ where
|
|||
self.executor.spawn(future);
|
||||
}
|
||||
|
||||
/// Sends a message concurrently through the [`Runtime`].
|
||||
pub fn send(&mut self, message: Message) {
|
||||
let mut sender = self.sender.clone();
|
||||
|
||||
self.executor.spawn(async move {
|
||||
let _ = sender.send(message).await;
|
||||
});
|
||||
}
|
||||
|
||||
/// Tracks a [`Subscription`] in the [`Runtime`].
|
||||
///
|
||||
/// It will spawn new streams or close old ones as necessary! See
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue