9.2 KiB
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
1.0.0 - Unreleased
Breaking changes
- The minimum supported Rust version (MSRV) is now Rust 1.65.
- Add the
stdfeature which should be disabled inno_stdenvironments. - All Cargo features, except
std, are now disabled by default. Thefullfeature can be used to get the old behavior of supporting all possible derives. - The
TryFrom,Add,Sub,BitAnd,BitOr,BitXor,NotandNegderives now return a dedicated error type instead of a&'static stron error. - The
FromStrderive now uses a dedicatedFromStrErrorerror type instead of generating unique one each time. - The
Displayderive (and otherfmt-like ones) now uses#[display("...", (<expr>),*)]syntax instead of#[display(fmt = "...", ("<expr>"),*)], and#[display(bound(<bound>))]instead of#[display(bound = "<bound>")]. So without the double quotes around the expressions and bounds. - The
DebugCustomderive is renamed to justDebug(gated now under a separatedebugfeature), and its semantics were changed to be a superset ofstdvariant ofDebug. - The
Fromderive doesn't deriveFrom<()>for enum variants without any fields anymore. This feature was removed because it was considered useless in practice. - The
Fromderive now uses#[from(<types>)]instead of#[from(types(<types>))]and ignores field type itself. - The
Intoderive now uses#[into(<types>)]instead of#[into(types(<types>))]and ignores field type itself. - Importing a derive macro now also import its corresponding trait.
Added
- Add support captured identifiers in
Displayderives. So now you can use:#[display(fmt = "Prefix: {field}")]instead of needing to use#[display(fmt = "Prefix: {}", field)] - Add
FromStrderive support for enums that contain variants without fields. If you pass the name of the variant tofrom_strit will create the matching variant. - Add
#[unwrap(owned, ref, ref_mut)]attribute for theUnwrapderive. By using them, it is possible to derive implementations for the reference types as well. (#206) - Add
TryUnwrapderive similar to theUnwrapderive. This one returns aResultand does not panic. (#206)
Changed
- The
ConstructorandIsVariantderives now generateconst fnfunctions. - The
UnwrapandIsVariantderives now generate doc comments. #[automatically_derived]is now emitted from all macro expansions. This should prevent code style linters from attempting to modify the generated code.- Upgrade to
syn2.0. - The
Errorderive now works in nightlyno_stdenvironments when enabling#![feature(error_in_core)].
Fixed
- Use a deterministic
HashSetin all derives, this is needed for rust analyzer to work correctly. - Use
ProviderAPI for backtraces inErrorderive. - Fix
Errorderive not working withconstgenerics. - Support trait objects for source in Error, e.g.
Box<dyn Error + Send + 'static>
0.99.10 - 2020-09-11
Added
Fromsupports additional types for conversion:#[from(types(u8, u16))].
0.99.7 - 2020-05-16
Changed
- When specifying specific features of the crate to only enable specific
derives, the
extra-traitsfeature ofsynis not always enabled when those the specified features do not require it. This should speed up compile time ofsynwhen this feature is not needed.
Fixed
- Fix generic derives for
MulAssign
0.99.6 - 2020-05-13
Changed
- Make sure output of derives is deterministic, for better support in rust-analyzer
0.99.5 - 2020-03-28
Added
- Support for deriving
Error!!! (many thanks to @ffuugoo and @tyranron)
Fixed
-
Fix generic bounds for
DerefandDerefMutwithforward, i.e. putDerefbound on whole type, so onwhere Box<T>: Derefinstead of onT: Deref. (#107) -
The
testsdirectory is now correctly included in the crate (requested by Debian package maintainers)
0.99.4 - 2020-03-28 [YANKED]
Note: This version is yanked, because quickly after release it was found out tests did not run in CI.
0.99.3 - 2020-02-19
Fixed
- Fix generic bounds for
DerefandDerefMutwith noforward, i.e. no bounds are necessary. (#107)
0.99.2 - 2019-11-17
Fixed
- Hotfix for a regression in allowed
Displayderives using#flag, such as{:#b}(#107)
0.99.1 - 2019-11-12
Fixed
- Hotfix for a regression in allowed
Fromderives (#105)
0.99.0 - 2019-11-11
This release is a huge milestone for this library. Lot's of new derives are implemented and a ton of attributes are added for configuration purposes. These attributes will allow future releases to add features/options without breaking backwards compatibility. This is why the next release with breaking changes is planned to be 1.0.0.
Breaking changes
- The minimum supported rust version (MSRV) is now Rust 1.36.
- When using in a Rust 2015 crate, you should add
extern crate coreto your code. no_stdfeature is removed, the library now supportsno_stdwithout having to configure any features.
Added
Derefderives now dereference to the type in the newtype. So if you haveMyBox(Box<i32>), dereferencing it will result in aBox<i32>not ani32. To get the old behaviour of forwarding the dereference you can add the#[deref(forward)]attribute on the struct or field.- Derives for
AsRef,AsMut,Sum,Product,IntoIterator. - Choosing the field of a struct for which to derive the newtype derive.
- Ignoring variants of enums when deriving
From, by using#[from(ignore)]. - Add
#[from(forward)]attribute forFromderives. This forwards thefromcalls to the fields themselves. So if your field is ani64you can call from on ani32and it will work. - Add
#[mul(forward)]and#[mul_assign(forward)], which implementMulandMulAssignwith the semantics as if they wereAdd/AddAssign. - You can use features to cut down compile time of the crate by only compiling the code needed for the derives that you use. (see Cargo.toml for the features, by default they are all on)
- Add
#[into(owned, ref, ref_mut)]and#[try_into(owned, ref, ref_mut)]attributes. These cause theIntoandTryIntoderives to also implement derives that return references to the inner fields. - Allow
#[display(fmt="some shared display text for all enum variants {}")]attribute on enum. - Better bounds inference of
Displaytrait.
Changed
- Remove dependency on
regexto cut down compile time. - Use
syn1.0
0.15.0 - 2019-06-08
Fixed
- Automatic detection of traits needed for
Displayformat strings
0.14.0 - 2019-02-02
Added
- Added
no_stdsupport
Changed
- Suppress
unused_variableswarnings in derives
0.13.0 - 2018-10-19
Added
- Extended Display-like derives to support custom formats
Changed
- Updated to
synv0.15
0.12.0 - 2018-09-19
Changed
- Updated to
synv0.14,quotev0.6 andproc-macro2v0.4
0.11.0 - 2018-05-12
Changed
- Updated to latest version of
synandquote
Fixed
- Changed some URLs in the docs so they were correct on crates.io and docs.rs
- The
Resulttype is now referenced in the derives using its absolute path (::std::result::Result) to make sure that the derives don't accidentally use anotherResulttype that is in scope.
0.10.0 - 2018-03-29
Added
- Allow deriving of
TryInto - Allow deriving of
Deref - Allow deriving of
DerefMut
0.9.0 - 2018-03-18
Added
- Allow deriving of
Display,Binary,Octal,LowerHex,UpperHex,LowerExp,UpperExp,Pointer - Allow deriving of
Index - Allow deriving of
IndexMut
Fixed
- Allow cross crate inlining of derived methods
0.8.0 - 2018-03-10
Added
- Allow deriving of
FromStr
Changed
- Updated to latest version of
synandquote
0.7.1 - 2018-01-25
Fixed
- Add
#[allow(missing_docs)]to the Constructor definition
0.7.0 - 2017-07-25
Changed
- Changed code to work with newer version of the
synlibrary.
0.6.2 - 2017-04-23
Changed
- Deriving
From,IntoandConstructornow works for empty structs.
0.6.1 - 2017-03-08
Changed
- The
new()method that is created when derivingConstructoris now public. This makes it a lot more useful.
0.6.0 - 2017-02-20
Added
- Derives for
Into,ConstructorandMulAssign-like
Changed
Fromis now derived for enum variants with multiple fields.
Fixed
- Derivations now support generics.
0.5.0 - 2017-02-02
Added
- Lots of docs.
- Derives for
Neg-like andAddAssign-like.
Changed
Fromcan now be derived for structs with multiple fields.