Plug Emulator into devtools 🎉

This commit is contained in:
Héctor Ramón Jiménez 2025-05-31 05:50:25 +02:00
parent 16556b51bc
commit ed528c9c53
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
4 changed files with 158 additions and 32 deletions

View file

@ -27,6 +27,7 @@ pub struct Emulator<P: Program> {
#[allow(missing_debug_implementations)]
pub enum Event<P: Program> {
Action(Action<P::Message>),
Ready,
}
impl<P: Program + 'static> Emulator<P> {
@ -58,6 +59,9 @@ impl<P: Program + 'static> Emulator<P> {
runtime.run(stream.map(Event::Action).boxed());
}
// TODO: Async boot environments
runtime.send(Event::Ready);
Self {
state,
runtime,
@ -144,6 +148,8 @@ impl<P: Program + 'static> Emulator<P> {
for message in messages {
self.update(program, message);
}
self.runtime.send(Event::Ready);
}
pub fn view(

View file

@ -96,6 +96,7 @@ pub mod simulator;
mod error;
pub use emulator::Emulator;
pub use error::Error;
pub use instruction::Instruction;
pub use selector::Selector;