| 1 |
# Changelog |
| 2 |
|
| 3 |
All notable changes to this project will be documented in this file. |
| 4 |
|
| 5 |
The format is based on [Keep a Changelog](http://keepachangelog.com/) |
| 6 |
and this project adheres to [Semantic Versioning](http://semver.org/). |
| 7 |
|
| 8 |
|
| 9 |
## 1.0.0 - Unreleased |
| 10 |
|
| 11 |
### Breaking changes |
| 12 |
|
| 13 |
- The minimum supported Rust version (MSRV) is now Rust 1.65. |
| 14 |
- Add the `std` feature which should be disabled in `no_std` environments. |
| 15 |
- All Cargo features, except `std`, are now disabled by default. The `full` |
| 16 |
feature can be used to get the old behavior of supporting all possible |
| 17 |
derives. |
| 18 |
- The `TryFrom`, `Add`, `Sub`, `BitAnd`, `BitOr`, `BitXor`, `Not` and `Neg` |
| 19 |
derives now return a dedicated error type instead of a `&'static str` on |
| 20 |
error. |
| 21 |
- The `FromStr` derive now uses a dedicated `FromStrError` error type instead |
| 22 |
of generating unique one each time. |
| 23 |
- The `Display` derive (and other `fmt`-like ones) now uses |
| 24 |
`#[display("...", (<expr>),*)]` syntax instead of |
| 25 |
`#[display(fmt = "...", ("<expr>"),*)]`, and `#[display(bound(<bound>))]` |
| 26 |
instead of `#[display(bound = "<bound>")]`. So without the double quotes |
| 27 |
around the expressions and bounds. |
| 28 |
- The `DebugCustom` derive is renamed to just `Debug` (gated now under a separate |
| 29 |
`debug` feature), and its semantics were changed to be a superset of `std` variant |
| 30 |
of `Debug`. |
| 31 |
- The `From` derive doesn't derive `From<()>` for enum variants without any |
| 32 |
fields anymore. This feature was removed because it was considered useless in |
| 33 |
practice. |
| 34 |
- The `From` derive now uses `#[from(<types>)]` instead of `#[from(types(<types>))]` |
| 35 |
and ignores field type itself. |
| 36 |
- The `Into` derive now uses `#[into(<types>)]` instead of `#[into(types(<types>))]` |
| 37 |
and ignores field type itself. |
| 38 |
- Importing a derive macro now also import its corresponding trait. |
| 39 |
|
| 40 |
### Added |
| 41 |
|
| 42 |
- Add support captured identifiers in `Display` derives. So now you can use: |
| 43 |
`#[display(fmt = "Prefix: {field}")]` instead of needing to use |
| 44 |
`#[display(fmt = "Prefix: {}", field)]` |
| 45 |
- Add `FromStr` derive support for enums that contain variants without fields. |
| 46 |
If you pass the name of the variant to `from_str` it will create the matching |
| 47 |
variant. |
| 48 |
- Add `#[unwrap(owned, ref, ref_mut)]` attribute for the `Unwrap` derive. |
| 49 |
By using them, it is possible to derive implementations for the reference types as well. |
| 50 |
([#206](https://github.com/JelteF/derive_more/pull/206)) |
| 51 |
- Add `TryUnwrap` derive similar to the `Unwrap` derive. This one returns a `Result` and does not panic. |
| 52 |
([#206](https://github.com/JelteF/derive_more/pull/206)) |
| 53 |
|
| 54 |
### Changed |
| 55 |
|
| 56 |
- The `Constructor` and `IsVariant` derives now generate `const fn` functions. |
| 57 |
- The `Unwrap` and `IsVariant` derives now generate doc comments. |
| 58 |
- `#[automatically_derived]` is now emitted from all macro expansions. This |
| 59 |
should prevent code style linters from attempting to modify the generated |
| 60 |
code. |
| 61 |
- Upgrade to `syn` 2.0. |
| 62 |
- The `Error` derive now works in nightly `no_std` environments when enabling |
| 63 |
`#![feature(error_in_core)]`. |
| 64 |
|
| 65 |
### Fixed |
| 66 |
|
| 67 |
- Use a deterministic `HashSet` in all derives, this is needed for rust analyzer |
| 68 |
to work correctly. |
| 69 |
- Use `Provider` API for backtraces in `Error` derive. |
| 70 |
- Fix `Error` derive not working with `const` generics. |
| 71 |
- Support trait objects for source in Error, e.g. |
| 72 |
`Box<dyn Error + Send + 'static>` |
| 73 |
|
| 74 |
## 0.99.10 - 2020-09-11 |
| 75 |
|
| 76 |
### Added |
| 77 |
|
| 78 |
- `From` supports additional types for conversion: `#[from(types(u8, u16))]`. |
| 79 |
|
| 80 |
|
| 81 |
## 0.99.7 - 2020-05-16 |
| 82 |
|
| 83 |
### Changed |
| 84 |
|
| 85 |
- When specifying specific features of the crate to only enable specific |
| 86 |
derives, the `extra-traits` feature of `syn` is not always enabled |
| 87 |
when those the specified features do not require it. This should speed up |
| 88 |
compile time of `syn` when this feature is not needed. |
| 89 |
|
| 90 |
### Fixed |
| 91 |
|
| 92 |
- Fix generic derives for `MulAssign` |
| 93 |
|
| 94 |
## 0.99.6 - 2020-05-13 |
| 95 |
|
| 96 |
### Changed |
| 97 |
|
| 98 |
- Make sure output of derives is deterministic, for better support in |
| 99 |
rust-analyzer |
| 100 |
|
| 101 |
|
| 102 |
## 0.99.5 - 2020-03-28 |
| 103 |
|
| 104 |
### Added |
| 105 |
|
| 106 |
- Support for deriving `Error`!!! (many thanks to @ffuugoo and @tyranron) |
| 107 |
|
| 108 |
### Fixed |
| 109 |
|
| 110 |
- Fix generic bounds for `Deref` and `DerefMut` with `forward`, i.e. put `Deref` |
| 111 |
bound on whole type, so on `where Box<T>: Deref` instead of on `T: Deref`. |
| 112 |
([#107](https://github.com/JelteF/derive_more/issues/114)) |
| 113 |
|
| 114 |
- The `tests` directory is now correctly included in the crate (requested by |
| 115 |
Debian package maintainers) |
| 116 |
|
| 117 |
## 0.99.4 - 2020-03-28 [YANKED] |
| 118 |
|
| 119 |
Note: This version is yanked, because quickly after release it was found out |
| 120 |
tests did not run in CI. |
| 121 |
|
| 122 |
## 0.99.3 - 2020-02-19 |
| 123 |
|
| 124 |
### Fixed |
| 125 |
|
| 126 |
- Fix generic bounds for `Deref` and `DerefMut` with no `forward`, i.e. no bounds |
| 127 |
are necessary. ([#107](https://github.com/JelteF/derive_more/issues/114)) |
| 128 |
|
| 129 |
|
| 130 |
## 0.99.2 - 2019-11-17 |
| 131 |
|
| 132 |
### Fixed |
| 133 |
|
| 134 |
- Hotfix for a regression in allowed `Display` derives using `#` flag, such as |
| 135 |
`{:#b}` ([#107](https://github.com/JelteF/derive_more/issues/107)) |
| 136 |
|
| 137 |
## 0.99.1 - 2019-11-12 |
| 138 |
|
| 139 |
### Fixed |
| 140 |
|
| 141 |
- Hotfix for a regression in allowed `From` derives |
| 142 |
([#105](https://github.com/JelteF/derive_more/issues/105)) |
| 143 |
|
| 144 |
## 0.99.0 - 2019-11-11 |
| 145 |
|
| 146 |
This release is a huge milestone for this library. |
| 147 |
Lot's of new derives are implemented and a ton of attributes are added for |
| 148 |
configuration purposes. |
| 149 |
These attributes will allow future releases to add features/options without |
| 150 |
breaking backwards compatibility. |
| 151 |
This is why the next release with breaking changes is planned to be 1.0.0. |
| 152 |
|
| 153 |
### Breaking changes |
| 154 |
- The minimum supported rust version (MSRV) is now Rust 1.36. |
| 155 |
- When using in a Rust 2015 crate, you should add `extern crate core` to your |
| 156 |
code. |
| 157 |
- `no_std` feature is removed, the library now supports `no_std` without having |
| 158 |
to configure any features. |
| 159 |
|
| 160 |
|
| 161 |
### Added |
| 162 |
|
| 163 |
- `Deref` derives now dereference to the type in the newtype. So if you have |
| 164 |
`MyBox(Box<i32>)`, dereferencing it will result in a `Box<i32>` not an `i32`. |
| 165 |
To get the old behaviour of forwarding the dereference you can add the |
| 166 |
`#[deref(forward)]` attribute on the struct or field. |
| 167 |
- Derives for `AsRef`, `AsMut`, `Sum`, `Product`, `IntoIterator`. |
| 168 |
- Choosing the field of a struct for which to derive the newtype derive. |
| 169 |
- Ignoring variants of enums when deriving `From`, by using `#[from(ignore)]`. |
| 170 |
- Add `#[from(forward)]` attribute for `From` derives. This forwards the `from` |
| 171 |
calls to the fields themselves. So if your field is an `i64` you can call from |
| 172 |
on an `i32` and it will work. |
| 173 |
- Add `#[mul(forward)]` and `#[mul_assign(forward)]`, which implement `Mul` and |
| 174 |
`MulAssign` with the semantics as if they were `Add`/`AddAssign`. |
| 175 |
- You can use features to cut down compile time of the crate by only compiling |
| 176 |
the code needed for the derives that you use. (see Cargo.toml for the |
| 177 |
features, by default they are all on) |
| 178 |
- Add `#[into(owned, ref, ref_mut)]` and `#[try_into(owned, ref, ref_mut)]` |
| 179 |
attributes. These cause the `Into` and `TryInto` derives to also implement |
| 180 |
derives that return references to the inner fields. |
| 181 |
- Allow `#[display(fmt="some shared display text for all enum variants {}")]` |
| 182 |
attribute on enum. |
| 183 |
- Better bounds inference of `Display` trait. |
| 184 |
|
| 185 |
### Changed |
| 186 |
|
| 187 |
- Remove dependency on `regex` to cut down compile time. |
| 188 |
- Use `syn` 1.0 |
| 189 |
|
| 190 |
## 0.15.0 - 2019-06-08 |
| 191 |
|
| 192 |
### Fixed |
| 193 |
|
| 194 |
- Automatic detection of traits needed for `Display` format strings |
| 195 |
|
| 196 |
## 0.14.0 - 2019-02-02 |
| 197 |
|
| 198 |
### Added |
| 199 |
|
| 200 |
- Added `no_std` support |
| 201 |
|
| 202 |
### Changed |
| 203 |
|
| 204 |
- Suppress `unused_variables` warnings in derives |
| 205 |
|
| 206 |
## 0.13.0 - 2018-10-19 |
| 207 |
|
| 208 |
### Added |
| 209 |
|
| 210 |
- Extended Display-like derives to support custom formats |
| 211 |
|
| 212 |
### Changed |
| 213 |
|
| 214 |
- Updated to `syn` v0.15 |
| 215 |
|
| 216 |
## 0.12.0 - 2018-09-19 |
| 217 |
|
| 218 |
### Changed |
| 219 |
|
| 220 |
- Updated to `syn` v0.14, `quote` v0.6 and `proc-macro2` v0.4 |
| 221 |
|
| 222 |
## 0.11.0 - 2018-05-12 |
| 223 |
|
| 224 |
### Changed |
| 225 |
|
| 226 |
- Updated to latest version of `syn` and `quote` |
| 227 |
|
| 228 |
### Fixed |
| 229 |
|
| 230 |
- Changed some URLs in the docs so they were correct on crates.io and docs.rs |
| 231 |
- The `Result` type is now referenced in the derives using its absolute path |
| 232 |
(`::std::result::Result`) to make sure that the derives don't accidentally use |
| 233 |
another `Result` type that is in scope. |
| 234 |
|
| 235 |
## 0.10.0 - 2018-03-29 |
| 236 |
|
| 237 |
### Added |
| 238 |
|
| 239 |
- Allow deriving of `TryInto` |
| 240 |
- Allow deriving of `Deref` |
| 241 |
- Allow deriving of `DerefMut` |
| 242 |
|
| 243 |
## 0.9.0 - 2018-03-18 |
| 244 |
|
| 245 |
### Added |
| 246 |
|
| 247 |
- Allow deriving of `Display`, `Binary`, `Octal`, `LowerHex`, `UpperHex`, `LowerExp`, `UpperExp`, `Pointer` |
| 248 |
- Allow deriving of `Index` |
| 249 |
- Allow deriving of `IndexMut` |
| 250 |
|
| 251 |
### Fixed |
| 252 |
|
| 253 |
- Allow cross crate inlining of derived methods |
| 254 |
|
| 255 |
## 0.8.0 - 2018-03-10 |
| 256 |
|
| 257 |
### Added |
| 258 |
|
| 259 |
- Allow deriving of `FromStr` |
| 260 |
|
| 261 |
### Changed |
| 262 |
|
| 263 |
- Updated to latest version of `syn` and `quote` |
| 264 |
|
| 265 |
## 0.7.1 - 2018-01-25 |
| 266 |
|
| 267 |
### Fixed |
| 268 |
|
| 269 |
- Add `#[allow(missing_docs)]` to the Constructor definition |
| 270 |
|
| 271 |
## 0.7.0 - 2017-07-25 |
| 272 |
|
| 273 |
### Changed |
| 274 |
|
| 275 |
- Changed code to work with newer version of the `syn` library. |
| 276 |
|
| 277 |
## 0.6.2 - 2017-04-23 |
| 278 |
|
| 279 |
### Changed |
| 280 |
|
| 281 |
- Deriving `From`, `Into` and `Constructor` now works for empty structs. |
| 282 |
|
| 283 |
## 0.6.1 - 2017-03-08 |
| 284 |
|
| 285 |
### Changed |
| 286 |
|
| 287 |
- The `new()` method that is created when deriving `Constructor` is now public. |
| 288 |
This makes it a lot more useful. |
| 289 |
|
| 290 |
## 0.6.0 - 2017-02-20 |
| 291 |
|
| 292 |
### Added |
| 293 |
|
| 294 |
- Derives for `Into`, `Constructor` and `MulAssign`-like |
| 295 |
|
| 296 |
### Changed |
| 297 |
|
| 298 |
- `From` is now derived for enum variants with multiple fields. |
| 299 |
|
| 300 |
### Fixed |
| 301 |
|
| 302 |
- Derivations now support generics. |
| 303 |
|
| 304 |
## 0.5.0 - 2017-02-02 |
| 305 |
|
| 306 |
### Added |
| 307 |
|
| 308 |
- Lots of docs. |
| 309 |
- Derives for `Neg`-like and `AddAssign`-like. |
| 310 |
|
| 311 |
### Changed |
| 312 |
|
| 313 |
- `From` can now be derived for structs with multiple fields. |