These code blocks enable passing in enum variants (that have identically named structs) from Python. None of this code has been tested because there are no constructor methods for ConvnentionalLoco, HybridLoco, etc in Python -- I plan to fix this but not with any significant urgency. However, because this is Rust and compiles, then in probably works as expected.
Changes
Python API foundation for cleaner API
These code blocks enable passing in enum variants (that have identically named structs) from Python. None of this code has been tested because there are no constructor methods for
ConvnentionalLoco
,HybridLoco
, etc in Python -- I plan to fix this but not with any significant urgency. However, because this is Rust and compiles, then in probably works as expected.From<HybridLoco> for LocoType
is not automatically generated byenum_dispatch
because of theBox<HybridLoco>
https://github.com/NREL/altrios/blob/103b658135913ad8ffd6d4b469fe71416a0c4267/rust/altrios-core/src/consist/locomotive/locomotive_model.rs#L16-L20