Skip to content

Support conversion between types #66

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

Open
mxgrey opened this issue Apr 17, 2025 · 0 comments
Open

Support conversion between types #66

mxgrey opened this issue Apr 17, 2025 · 0 comments

Comments

@mxgrey
Copy link
Contributor

mxgrey commented Apr 17, 2025

Rust has excellent support for converting between data types with the Into, From, TryFrom, and TryInto traits. We could leverage these traits to allow users to register conversions between message types. We could support implicit conversion for any output type that supports Into<T> for its target input.

We could also support implicit conversion when TryInto is available, but this might be an opt-in setting that the user toggles at the diagram level or inside the specific node where the implicit conversion should be allowed. Just like implicit deserialization, an implicit TryInto would direct errors towards the on_implicit_error target.

We should also automatically support implicit conversions from smaller primitives to larger primitives where there is no risk of overflow or loss of precision, e.g. i8 -> i16 -> i32 -> i64, or less obviously u8 -> i16, u16 -> i32.

@mxgrey mxgrey added this to PMC Board Apr 17, 2025
@github-project-automation github-project-automation bot moved this to Inbox in PMC Board Apr 17, 2025
@mxgrey mxgrey moved this from Inbox to Todo in PMC Board Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

1 participant