25 Jun
2020
25 Jun
'20
1:54 a.m.
(3) Make each each VmRequest case a newtype, like so:
#[derive(MsgOnSocket, Debug)] pub enum VmRequest { Exit(Exit), Suspend(Suspend), ... }
This would basically be a workaround for the fact that enum variants in Rust aren't proper types. If they were, though (which we can emulate through this approach), we could have some trait with an associated socket type for executing each type of request.
The machine crate might make this option a bit less annoying: https://github.com/rust-bakery/machine