diff --git a/CHANGELOG.md b/CHANGELOG.md index c8604697..b8092ecf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,23 +5,32 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 1.0.1 - Unreleased -## 1.0.0 - Unreleased + + +## 1.0.0 - 2024-08-06 More than 8 years after the first commit and almost 5 years after the 0.99.0 release, `derive_more` has finally reached its 1.0.0 release. This release -contains a lot of changes (including breaking ones) to make it easier to use -the derives and make it possible to extend them without having to breaking -backwards compatibility again. There are three major changes that I would like +contains a lot of changes (including some breaking ones) to make it easier to +use the derives and make it possible to extend them without having to breaking +backwards compatibility again. There are five major changes that I would like to call out, but there are many more changes that are documented below: -1. A new `Debug` derive that can be used to easily customize `Debug` formatting. +1. There is a new `Debug` derive that can be used to easily customize `Debug` + formatting. 2. A greatly improved `Display` derive, which allows you to do anything that - `thiserror` provides, but it works for any type not just errors. And by - combining the `Display` derive with the `Error` and `From` derives, there - shouldn't really be any need to use `thiserror` anymore (if you do have such - a need please report an issue). + [`thiserror`](https://github.com/dtolnay/thiserror) provides, but it works + for any type not just errors. And by combining the `Display` derive with the + `Error` and `From` derives, there shouldn't really be any need to use + `thiserror` anymore (if you are missing a feature/behaviour from `thiserror` + please report an issue). 3. Traits that can return errors now return a type that implements `Error` when an error occurs instead of a `&'static str`. +4. When using `use derive_more::SomeTrait` the actual trait is also imported + not just the derive macro. This is especially useful for `Error` and + `Display` +5. The docs are now rendered on docs.rs and are much more readable. ### Breaking changes @@ -57,14 +66,16 @@ to call out, but there are many more changes that are documented below: and ignores field type itself. - The `Into` derive now generates separate impls for each field whenever the `#[into(...)]` attribute is applied to it. ([#291](https://github.com/JelteF/derive_more/pull/291)) -- Importing a derive macro now also import its corresponding trait. +- Importing a derive macro now also imports its corresponding trait. - The `Error` derive is updated with changes to the `error_generic_member_access` unstable feature for nightly users. ([#200](https://github.com/JelteF/derive_more/pull/200), [#294](https://github.com/JelteF/derive_more/pull/294)) - The `as_mut` feature is removed, and the `AsMut` derive is now gated by the `as_ref` feature. ([#295](https://github.com/JelteF/derive_more/pull/295)) - A top level `#[display("...")]` attribute on an enum now requires the usage - of `{_variant}` to include the variant instead of including it at `{}`. ([#377](https://github.com/JelteF/derive_more/pull/377)) + of `{_variant}` to include the variant instead of including it at `{}`. The + reason is that `{}` now references the first argument to the format string, + just like in all other format strings. ([#377](https://github.com/JelteF/derive_more/pull/377)) ### Added diff --git a/README.md b/README.md index 965b611a..b019bbaa 100644 --- a/README.md +++ b/README.md @@ -182,13 +182,13 @@ You have to enable each type of derive as a feature in `Cargo.toml`: [dependencies] # You can specify the types of derives that you need for less time spent # compiling. For the full list of features see this crate its `Cargo.toml`. -derive_more = { version = "=1.0.0-beta.6", features = ["from", "add", "iterator"] } +derive_more = { version = "1", features = ["from", "add", "iterator"] } ``` ```toml [dependencies] # If you don't care much about compilation times and simply want to have # support for all the possible derives, you can use the "full" feature. -derive_more = { version = "=1.0.0-beta.6", features = ["full"] } +derive_more = { version = "1", features = ["full"] } ``` ```toml [dependencies] @@ -196,7 +196,7 @@ derive_more = { version = "=1.0.0-beta.6", features = ["full"] } # because the only default feature is the "std" feature. # NOTE: You can combine this with "full" feature to get support for all the # possible derives in a `no_std` environment. -derive_more = { version = "=1.0.0-beta.6", default-features = false } +derive_more = { version = "1", default-features = false } ``` And this to the top of your Rust file: @@ -223,7 +223,7 @@ Changing [MSRV] (minimum supported Rust version) of this crate is treated as a * [dependencies] derive_more = "1" # or "1.0", or "^1.0" ``` -- However, if [MSRV] changes are concerning for your project, then use the [tilde requirement] to **omit breaking code**: +- However, if [MSRV] changes are concerning for your project, then use the [tilde requirement] to **pin to a specific minor version**: ```toml [dependencies] derive_more = "~1.0" # or "~1.0.0" @@ -235,35 +235,35 @@ Changing [MSRV] (minimum supported Rust version) of this crate is treated as a * [`cargo-expand`]: https://github.com/dtolnay/cargo-expand [`derive-new`]: https://github.com/nrc/derive-new -[`From`]: https://docs.rs/derive_more/1.0.0-beta.6/derive_more/derive.From.html -[`Into`]: https://docs.rs/derive_more/1.0.0-beta.6/derive_more/derive.Into.html -[`FromStr`]: https://docs.rs/derive_more/1.0.0-beta.6/derive_more/derive.FromStr.html -[`TryFrom`]: https://docs.rs/derive_more/1.0.0-beta.6/derive_more/derive.TryFrom.html -[`TryInto`]: https://docs.rs/derive_more/1.0.0-beta.6/derive_more/derive.TryInto.html -[`IntoIterator`]: https://docs.rs/derive_more/1.0.0-beta.6/derive_more/derive.IntoIterator.html -[`AsRef`]: https://docs.rs/derive_more/1.0.0-beta.6/derive_more/derive.AsRef.html -[`AsMut`]: https://docs.rs/derive_more/1.0.0-beta.6/derive_more/derive.AsMut.html - -[`Debug`]: https://docs.rs/derive_more/1.0.0-beta.6/derive_more/derive.Debug.html -[`Display`-like]: https://docs.rs/derive_more/1.0.0-beta.6/derive_more/derive.Display.html - -[`Error`]: https://docs.rs/derive_more/1.0.0-beta.6/derive_more/derive.Error.html - -[`Index`]: https://docs.rs/derive_more/1.0.0-beta.6/derive_more/derive.Index.html -[`Deref`]: https://docs.rs/derive_more/1.0.0-beta.6/derive_more/derive.Deref.html -[`Not`-like]: https://docs.rs/derive_more/1.0.0-beta.6/derive_more/derive.Not.html -[`Add`-like]: https://docs.rs/derive_more/1.0.0-beta.6/derive_more/derive.Add.html -[`Mul`-like]: https://docs.rs/derive_more/1.0.0-beta.6/derive_more/derive.Mul.html -[`Sum`-like]: https://docs.rs/derive_more/1.0.0-beta.6/derive_more/derive.Sum.html -[`IndexMut`]: https://docs.rs/derive_more/1.0.0-beta.6/derive_more/derive.IndexMut.html -[`DerefMut`]: https://docs.rs/derive_more/1.0.0-beta.6/derive_more/derive.DerefMut.html -[`AddAssign`-like]: https://docs.rs/derive_more/1.0.0-beta.6/derive_more/derive.AddAssign.html -[`MulAssign`-like]: https://docs.rs/derive_more/1.0.0-beta.6/derive_more/derive.MulAssign.html - -[`Constructor`]: https://docs.rs/derive_more/1.0.0-beta.6/derive_more/derive.Constructor.html -[`IsVariant`]: https://docs.rs/derive_more/1.0.0-beta.6/derive_more/derive.IsVariant.html -[`Unwrap`]: https://docs.rs/derive_more/1.0.0-beta.6/derive_more/derive.Unwrap.html -[`TryUnwrap`]: https://docs.rs/derive_more/1.0.0-beta.6/derive_more/derive.TryUnwrap.html +[`From`]: https://docs.rs/derive_more/latest/derive_more/derive.From.html +[`Into`]: https://docs.rs/derive_more/latest/derive_more/derive.Into.html +[`FromStr`]: https://docs.rs/derive_more/latest/derive_more/derive.FromStr.html +[`TryFrom`]: https://docs.rs/derive_more/latest/derive_more/derive.TryFrom.html +[`TryInto`]: https://docs.rs/derive_more/latest/derive_more/derive.TryInto.html +[`IntoIterator`]: https://docs.rs/derive_more/latest/derive_more/derive.IntoIterator.html +[`AsRef`]: https://docs.rs/derive_more/latest/derive_more/derive.AsRef.html +[`AsMut`]: https://docs.rs/derive_more/latest/derive_more/derive.AsMut.html + +[`Debug`]: https://docs.rs/derive_more/latest/derive_more/derive.Debug.html +[`Display`-like]: https://docs.rs/derive_more/latest/derive_more/derive.Display.html + +[`Error`]: https://docs.rs/derive_more/latest/derive_more/derive.Error.html + +[`Index`]: https://docs.rs/derive_more/latest/derive_more/derive.Index.html +[`Deref`]: https://docs.rs/derive_more/latest/derive_more/derive.Deref.html +[`Not`-like]: https://docs.rs/derive_more/latest/derive_more/derive.Not.html +[`Add`-like]: https://docs.rs/derive_more/latest/derive_more/derive.Add.html +[`Mul`-like]: https://docs.rs/derive_more/latest/derive_more/derive.Mul.html +[`Sum`-like]: https://docs.rs/derive_more/latest/derive_more/derive.Sum.html +[`IndexMut`]: https://docs.rs/derive_more/latest/derive_more/derive.IndexMut.html +[`DerefMut`]: https://docs.rs/derive_more/latest/derive_more/derive.DerefMut.html +[`AddAssign`-like]: https://docs.rs/derive_more/latest/derive_more/derive.AddAssign.html +[`MulAssign`-like]: https://docs.rs/derive_more/latest/derive_more/derive.MulAssign.html + +[`Constructor`]: https://docs.rs/derive_more/latest/derive_more/derive.Constructor.html +[`IsVariant`]: https://docs.rs/derive_more/latest/derive_more/derive.IsVariant.html +[`Unwrap`]: https://docs.rs/derive_more/latest/derive_more/derive.Unwrap.html +[`TryUnwrap`]: https://docs.rs/derive_more/latest/derive_more/derive.TryUnwrap.html [caret requirement]: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#caret-requirements [tilde requirement]: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#tilde-requirements