Commit b64eda4
authored
refactor: Add a new trait between AsmMachine and Box<AsmCoreMachine> (#473)
In current design, AsmMachine is a rigid type containing
Box<AsmCoreMachine> directly. This is required in a sense that assembly
VM needs to know the inner data structures of AsmCoreMachine so as to
function. However, It also puts a restriction on AsmMachine: while you
can do the following in Rust VM:
```
DefaultMachine<Foo<DefaultCoreMachine<...>>
```
as long as Foo implements SupportMachine via a newtype pattern, this is
not possible on AsmMachine. However there are certain cases we need
wrappers on `Box<AsmCoreMachine>` to customize behaviors. This commit
introduces a a new trait `AsmCoreMachineRevealer` between AsmMachine and
AsmCoreMachine, it provides a mean for users of AsmMachine to customize
its behavior, while also requires the presence of AsmCoreMachine, so
assembly VM can still function.
If only Rust has generic specialization, we won't need to go through all
those troubles...1 parent cfb1d01 commit b64eda4
3 files changed
+186
-139
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
0 commit comments