-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RegSpec is annoying to match on #11
Comments
what do you need my first thought is that i'm not very familiar with how also i'm very curious what you're using |
My use case for yaxpeax-x86 is CPU emulation inside a larger pc98 emulation project I am working on. I could parse instructions myself since I use a small subset of the available instructions x86 although Rust is a crate centric language so I'd rather shift the burden of the instruction parsing to some other crate I can contribute to so I can focus on the emulation rather than parsing opcodes and having to test for many hours to ensure my parsing is fool proof. Some of the instructions I have to implement such as impl Index<RegisterIndex> for CpuState {
type Output = Register;
...
}
impl IndexMut<RegisterIndex> for CpuState { ... } I could move to using some enum provided by The index impls are kept simple as they use a match statement and return a borrow of the specified register member of The register type is just a transparent
Eq across real and protected mode would be nice. Although this doesn't really solve my issue here since HashMap lookup would take far too long even if I used
Generally rustc will do a good job with type inference here. Worst case you may need to |
Would just like to point out you can match on RegSpec currently, it just requires an unstable feature to do so.
works with |
For my use case I need both the protected and real mode modules. To reduce duplicate code I need a way to convert the real and protected mode
RegSpec
into some enum I can match on for further operations.However since RegSpec cannot be matched I have to resort to messy code that that can lead to bugs because of missing variant statements:
It would be nice if yaxpeax added a sort of
RegEnum
that could be matched on the to make these types of statements less annoying to work with.The text was updated successfully, but these errors were encountered: