Skip to content

Commit

Permalink
Redesign From derive macro (#241)
Browse files Browse the repository at this point in the history
Replace `#[from(types(i32, "&str"))]` with `#[from(i32, &str)]` and add
support for deriving multi-field structs and enum variants with
`#[from((<tuple>), (<tuple>), ...)]`.
  • Loading branch information
ilslv authored Jul 5, 2023
1 parent bc732a4 commit 60ed1e7
Show file tree
Hide file tree
Showing 26 changed files with 3,058 additions and 752 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- The `From` derive doesn't derive `From<()>` for enum variants without any
fields anymore. This feature was removed because it was considered useless in
practice.
- The `From` derive now uses `#[from(<types>)]` instead of `#[from(types(<types>))]`
and ignores field type itself.

### Added

Expand Down
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ rustc_version = { version = "0.4", optional = true }

[dev-dependencies]
rustversion = "1.0"
static_assertions = "1.1"
trybuild = "1.0.56"

[badges]
Expand Down Expand Up @@ -229,7 +230,7 @@ required-features = ["try_unwrap"]
[[test]]
name = "compile_fail"
path = "tests/compile_fail/mod.rs"
required-features = ["debug", "display"]
required-features = ["debug", "display", "from"]

[[test]]
name = "no_std"
Expand Down
Loading

0 comments on commit 60ed1e7

Please sign in to comment.