Taaitaaiger / jlrs

Julia bindings for Rust
MIT License
408 stars 21 forks source link

Support for Rust enums? #103

Open VarLad opened 11 months ago

VarLad commented 11 months ago

Julia has libraries like Expronicon or MLStyle which provide Rust-like enums. Is it possible to somehow use these libraries to map Rust's enums to these types? (in the case of porting Rust libraries to Julia)

Taaitaaiger commented 11 months ago

I don't think so. There might be some cases where you can hack something together which works, but I expect that the layout of a Julia enum will typically be incompatible with a Rust enum.

Rust implementations of Julia types can already be generated by using JlrsCore.Reflect as long as the Julia type contains no unions that depend on type parameters and no atomic fields. Types generated with the packages you've mentioned should be compatible if those requirements are met.

Op wo 9 aug. 2023 21:30 schreef Chetan Vardhan @.***>:

Julia has libraries like Expronicon https://expronicon.rogerluo.dev/intro/adts/defining or MLStyle https://thautwarm.github.io/MLStyle.jl/latest/syntax/adt.html which provide Rust-like enums. Is it possible to somehow use these libraries to map Rust's enums to these types? (in the case of porting Rust libraries to Julia)

— Reply to this email directly, view it on GitHub https://github.com/Taaitaaiger/jlrs/issues/103, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOQBHHYWIRY3QFSDNBVVQALXUPQOVANCNFSM6AAAAAA3KOYFTY . You are receiving this because you are subscribed to this thread.Message ID: @.***>