Support conversion between types
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 72
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing implicit deserialization behavior and how nodes route errors to the on_implicit_error target. Define the intended behavior for Into, opt-in TryInto, and lossless primitive conversions, including where conversion settings belong and how successful and failed conversions should be recognized as done.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100