rust-embedded / rust-embedded/svd2rust

Add try_from for enum variants

Open
#403 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
857
Forks
164
PR merge metrics
No merged PRs in 30d

Description

As From<enumVariant> for u8 is implemented in https://github.com/rust-embedded/svd2rust/pull/374.

What do you think about implementing TryFrom<u8> for enumVariant?

It could look something like this, in the generated code.

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=b703f510723d792edcd2776942cc02c7

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the generated-code example in the issue and the linked Rust playground. The payload names no repository files or tests, so locate the generator entry point and relevant generated-code tests; done means generated enum variants implement TryFrom with the intended conversion behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
embedded-iot, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.