-
Notifications
You must be signed in to change notification settings - Fork 1
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
Dynamic Codegen in Rust with Daedalus #67
Conversation
…logic into Calypso from Embedded-Base
…code, and simulate functions and mappings at compile time
format_data.rs is no longer generated, FormatData struct now hardcoded into data.rs Removed deprecated exports from lib.rs Removed calypsogen.py and its call in build.rs Changed Cargo.toml/.lock to include new dependencies (phf, cangen, daedalus) Removed deprecated files from .gitignore Now tracking decode_/encode_/simulate_data.rs, as they contain macro calls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will approve once tested Sunday. Really really cool. I do see room for improvement by deviating from how the python used to look and getting dynamicly into the bitreader logic a little more, but that is a task for a future PR.
Running |
Changes
Daedalus:
Embedded-Base/cangen
with Rust proc macrosEmbedded-Base/cangen/can-messages
, with a single macro call insrc/decode_data.rs
,src/encode_data.rs
, andsrc/simulate_data.rs
respectively.Cangen:
Embedded-Base/cangen
with equivalent Rust structsCalypso:
decode_data.rs
,encode_data.rs
, andsimulate_data.rs
are now generated with Daedalus macros. Since they're only 5 lines (pre-expansion), I've begun tracking them.phf
hash maps, instead of a struct wrapping a giant match function.FormatData
struct is no longer dynamically generated informat_data.rs
. Instead, is now hardcoded indata.rs
, andformat_data.rs
is removed. I hardcoded this since I assume that it will change very rarely. In the event that a new format is added, though, it will need to be added todata.rs
.main.rs
to work with Daedalus-generated code.Cargo.toml
andCargo.lock
.calypsogen.py
and its call inbuild.rs
.lib.rs
..gitignore
.Test Cases
mosquitto
,mqttui
, andcansend
, working as expectedcargo run --bin simulate
, working as expectedTo Do
Any remaining things that need to get done
Checklist
It can be helpful to check the
Checks
andFiles changed
tabs.Please reach out to your Project Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.
Closes #53