diff --git a/README.md b/README.md index 80019df2..331ccd46 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,6 @@ Strum has implemented the following macros: | [EnumMessage] | Add a verbose message to an enum variant. | | [EnumDiscriminants] | Generate a new type with only the discriminant names. | | [EnumCount] | Add a constant `usize` equal to the number of variants. | -| [ToString] | Serialize an enum to a String. | # Contributing @@ -78,4 +77,3 @@ Strumming is also a very whimsical motion, much like writing Rust code. [EnumMessage]: https://docs.rs/strum_macros/0.21/strum_macros/derive.EnumMessage.html [EnumDiscriminants]: https://docs.rs/strum_macros/0.21/strum_macros/derive.EnumDiscriminants.html [EnumCount]: https://docs.rs/strum_macros/0.21/strum_macros/derive.EnumCount.html -[ToString]: https://docs.rs/strum_macros/0.21/strum_macros/derive.ToString.html diff --git a/strum/src/additional_attributes.rs b/strum/src/additional_attributes.rs index e3d86ebd..8172a90f 100644 --- a/strum/src/additional_attributes.rs +++ b/strum/src/additional_attributes.rs @@ -9,7 +9,7 @@ //! use strum; //! use strum_macros; //! -//! #[derive(Debug, Eq, PartialEq, strum_macros::ToString)] +//! #[derive(Debug, Eq, PartialEq, strum_macros::Display)] //! #[strum(serialize_all = "snake_case")] //! enum Brightness { //! DarkBlack, @@ -43,7 +43,7 @@ //! be applied multiple times to an element and the enum variant will be parsed if any of them match. //! //! - `to_string="..."`: Similar to `serialize`. This value will be included when using `FromStr()`. More importantly, -//! this specifies what text to use when calling `variant.to_string()` with the `ToString` derivation, or when calling `variant.as_ref()` with `AsRefStr`. +//! this specifies what text to use when calling `variant.to_string()` with the `Display` derivation, or when calling `variant.as_ref()` with `AsRefStr`. //! //! - `default`: Applied to a single variant of an enum. The variant must be a Tuple-like //! variant with a single piece of data that can be create from a `&str` i.e. `T: From<&str>`. @@ -63,7 +63,7 @@ //! //! - `ascii_case_insensitive`: makes the comparison to this variant case insensitive (ASCII only). //! If the whole enum is marked `ascii_case_insensitive`, you can specify `ascii_case_insensitive = false` -//! to disable case insensitivity on this variant. +//! to disable case insensitivity on this v ariant. //! //! - `message=".."`: Adds a message to enum variant. This is used in conjunction with the `EnumMessage` //! trait to associate a message with a variant. If `detailed_message` is not provided, diff --git a/strum_macros/src/lib.rs b/strum_macros/src/lib.rs index b49da1e6..a9805db3 100644 --- a/strum_macros/src/lib.rs +++ b/strum_macros/src/lib.rs @@ -271,6 +271,7 @@ pub fn into_static_str(input: proc_macro::TokenStream) -> proc_macro::TokenStrea /// let yellow = Color::Yellow; /// assert_eq!(String::from("Yellow"), yellow.to_string()); /// ``` +#[deprecated(since="0.22.0", note="please use `#[derive(Display)]` instead. See issue https://github.com/Peternator7/strum/issues/132")] #[proc_macro_derive(ToString, attributes(strum))] pub fn to_string(input: proc_macro::TokenStream) -> proc_macro::TokenStream { let ast = syn::parse_macro_input!(input as DeriveInput);