Skip to content

feat(from_str): support rename attribute#536

Open
tisonkun wants to merge 4 commits intoJelteF:masterfrom
tisonkun:from_str-rename
Open

feat(from_str): support rename attribute#536
tisonkun wants to merge 4 commits intoJelteF:masterfrom
tisonkun:from_str-rename

Conversation

@tisonkun
Copy link

This refers to #216 and #480

Synopsis

This supports:

#[derive(Debug, Eq, FromStr, PartialEq)]
enum Enum {
    #[from_str(rename = "foo")]
    Foo,
    #[from_str(rename = "bar")]
    Bar,
}

Solution

Checklist

  • Documentation is updated (if required)
  • Tests are added/updated (if required)
  • CHANGELOG entry is added (if required)

@tisonkun
Copy link
Author

Let me try to fix CI failures.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compiler error output diverges between stable and nightly. Not sure what we can do.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird. I run cargo +stable test --workspace --features full,testing-helpers locally and it doesn't fail:

rustc --version --verbose
rustc 1.92.0 (ded5c06cf 2025-12-08)
binary: rustc
commit-hash: ded5c06cf21d2b93bffd5d884aa6e96934ee4234
commit-date: 2025-12-08
host: aarch64-apple-darwin
release: 1.92.0
LLVM version: 21.1.3

Signed-off-by: tison <wander4096@gmail.com>
@tisonkun
Copy link
Author

tisonkun commented Jan 15, 2026

cc @JelteF @tyranron

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant