mirror of
https://github.com/danog/strum.git
synced 2024-11-26 20:14:40 +01:00
ran cargo fmt
This commit is contained in:
parent
2b0fec6e97
commit
201876e3e5
@ -16,8 +16,8 @@
|
|||||||
//!
|
//!
|
||||||
//! ```toml
|
//! ```toml
|
||||||
//! [dependencies]
|
//! [dependencies]
|
||||||
//! strum = "0.15.0"
|
//! strum = "0.16.0"
|
||||||
//! strum_macros = "0.15.0"
|
//! strum_macros = "0.16.0"
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! And add these lines to the root of your project, either lib.rs or main.rs.
|
//! And add these lines to the root of your project, either lib.rs or main.rs.
|
||||||
@ -36,16 +36,27 @@
|
|||||||
//!
|
//!
|
||||||
//! | Macro | Description |
|
//! | Macro | Description |
|
||||||
//! | --- | ----------- |
|
//! | --- | ----------- |
|
||||||
//! | [EnumString](https://github.com/Peternator7/strum#EnumString) | Converts strings to enum variants based on their name |
|
//! | [EnumString] | Converts strings to enum variants based on their name |
|
||||||
//! | [Display](https://github.com/Peternator7/strum#Display) | Converts enum variants to strings |
|
//! | [Display] | Converts enum variants to strings |
|
||||||
//! | [AsRefStr](https://github.com/Peternator7/strum#AsRefStr) | Converts enum variants to `&'static str` |
|
//! | [AsRefStr] | Converts enum variants to `&'static str` |
|
||||||
//! | [IntoStaticStr](https://github.com/Peternator7/strum#IntoStaticStr) | Implements `From<MyEnum> for &'static str` on an enum |
|
//! | [IntoStaticStr] | Implements `From<MyEnum> for &'static str` on an enum |
|
||||||
//! | [EnumIter](https://github.com/Peternator7/strum#EnumIter) | Creates a new type that iterates of the variants of an enum. |
|
//! | [EnumVariantNames] | Adds a `variants` method returning an array of discriminant names |
|
||||||
//! | [EnumProperty](https://github.com/Peternator7/strum#EnumProperty) | Add custom properties to enum variants. |
|
//! | [EnumIter] | Creates a new type that iterates of the variants of an enum. |
|
||||||
//! | [EnumMessage](https://github.com/Peternator7/strum#EnumMessage) | Add a verbose message to an enum variant. |
|
//! | [EnumProperty] | Add custom properties to enum variants. |
|
||||||
//! | [EnumDiscriminants](https://github.com/Peternator7/strum#EnumDiscriminants) | Generate a new type with only the discriminant names. |
|
//! | [EnumMessage] | Add a verbose message to an enum variant. |
|
||||||
//! | [EnumCount](https://github.com/Peternator7/strum#EnumCount) | Add a constant `usize` equal to the number of variantes. |
|
//! | [EnumDiscriminants] | Generate a new type with only the discriminant names. |
|
||||||
|
//! | [EnumCount] | Add a constant `usize` equal to the number of variants. |
|
||||||
//!
|
//!
|
||||||
|
//! [EnumString]: https://github.com/Peternator7/strum/wiki/Derive-EnumString
|
||||||
|
//! [Display]: https://github.com/Peternator7/strum/wiki/Derive-Display
|
||||||
|
//! [AsRefStr]: https://github.com/Peternator7/strum/wiki/Derive-AsRefStr
|
||||||
|
//! [IntoStaticStr]: https://github.com/Peternator7/strum/wiki/Derive-IntoStaticStr
|
||||||
|
//! [EnumVariantNames]: https://github.com/Peternator7/strum/wiki/Derive-EnumVariantNames
|
||||||
|
//! [EnumIter]: https://github.com/Peternator7/strum/wiki/Derive-EnumIter
|
||||||
|
//! [EnumProperty]: https://github.com/Peternator7/strum/wiki/Derive-EnumProperty
|
||||||
|
//! [EnumMessage]: https://github.com/Peternator7/strum/wiki/Derive-EnumMessage
|
||||||
|
//! [EnumDiscriminants]: https://github.com/Peternator7/strum/wiki/Derive-EnumDiscriminants
|
||||||
|
//! [EnumCount]: https://github.com/Peternator7/strum/wiki/Derive-EnumCount
|
||||||
|
|
||||||
/// The ParseError enum is a collection of all the possible reasons
|
/// The ParseError enum is a collection of all the possible reasons
|
||||||
/// an enum can fail to parse from a string.
|
/// an enum can fail to parse from a string.
|
||||||
|
@ -112,7 +112,7 @@ pub fn enum_discriminants_inner(ast: &syn::DeriveInput) -> TokenStream {
|
|||||||
quote! { #name::#ident #params => #discriminants_name::#ident }
|
quote! { #name::#ident #params => #discriminants_name::#ident }
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
let from_fn_body = quote! { match val { #(#arms),* } };
|
let from_fn_body = quote! { match val { #(#arms),* } };
|
||||||
|
|
||||||
let (impl_generics, ty_generics, where_clause) = ast.generics.split_for_impl();
|
let (impl_generics, ty_generics, where_clause) = ast.generics.split_for_impl();
|
||||||
|
Loading…
Reference in New Issue
Block a user