-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split crate into a proc-macro and a regular library crate
proc-macro crates are loaded by the compiler instead of by the crate that depends on it. This means it's not possible to use anything else than exported anything else than exported proc-macros. But in some cases we want the generated derives to use structs or traits that are provided by the library. Two examples of this are: 1. An error type that can be used by the `Into` derive ([#173][173]) 2. Or to support trait objects for the `source` of the `Error` derive ([#122][122]) This change splits the layout of this crate in two. One crate that only exports proc-macros and is loaded by the compiler. And a second crate that re-exports all these macros but is also able to export different things such as structs and traits. NOTE: This only refactors the code in this repo. No functional changes happen in this change. These will be done in follow-up PRs. [173]: #173 [122]: #122
- Loading branch information
Showing
55 changed files
with
347 additions
and
266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
[package] | ||
name = "derive_more-impl" | ||
version = "0.99.17" | ||
edition = "2021" | ||
rust-version = "1.56.0" | ||
description = "Adds #[derive(x)] macros for more traits" | ||
authors = ["Jelte Fennema <github-tech@jeltef.nl>"] | ||
license = "MIT" | ||
repository = "https://github.com/JelteF/derive_more" | ||
documentation = "https://docs.rs/derive_more" | ||
|
||
# explicitly no keywords or categories so it cannot be found easily | ||
|
||
include = [ | ||
"src/**/*.rs", | ||
"doc/**/*.md", | ||
"Cargo.toml", | ||
"LICENSE", | ||
] | ||
|
||
[lib] | ||
proc-macro = true | ||
|
||
[dependencies] | ||
proc-macro2 = "1.0" | ||
quote = "1.0" | ||
syn = "1.0.81" | ||
convert_case = { version = "0.6", optional = true } | ||
unicode-xid = { version = "0.2.2", optional = true } | ||
|
||
[build-dependencies] | ||
rustc_version = { version = "0.4", optional = true } | ||
|
||
[dev-dependencies] | ||
rustversion = "1.0" | ||
trybuild = "1.0.56" | ||
|
||
[badges] | ||
github = { repository = "JelteF/derive_more", workflow = "CI" } | ||
|
||
[features] | ||
add_assign = [] | ||
add = [] | ||
as_mut = [] | ||
as_ref = [] | ||
constructor = [] | ||
deref = [] | ||
deref_mut = [] | ||
display = ["syn/extra-traits", "unicode-xid"] | ||
error = ["syn/extra-traits"] | ||
from = ["syn/extra-traits"] | ||
from_str = ["convert_case"] | ||
index = [] | ||
index_mut = [] | ||
into = ["syn/extra-traits"] | ||
into_iterator = [] | ||
iterator = [] | ||
mul_assign = ["syn/extra-traits"] | ||
mul = ["syn/extra-traits"] | ||
not = ["syn/extra-traits"] | ||
sum = [] | ||
try_into = ["syn/extra-traits"] | ||
testing-helpers = ["rustc_version"] | ||
is_variant = ["convert_case"] | ||
unwrap = ["convert_case", "rustc_version"] | ||
|
||
default = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# `derive_more-impl` | ||
|
||
This crate is an implementation detail of the [`derive_more`][crates.io]. If you | ||
found this crate by accident you're probably looking for one of the following | ||
pages of `derive_more`: | ||
1. [crates.io] | ||
2. [docs.rs][docs] | ||
3. [GitHub][github] | ||
|
||
[crates.io]: https://crates.io/crates/derive_more | ||
[docs.rs]: https://docs.rs/derive_more/latest/derive_more/ | ||
[GitHub]: https://github.com/JelteF/derive_more |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.