mirror of
https://github.com/danog/strum.git
synced 2024-11-26 20:14:40 +01:00
Handle rustoc comments in #[derive(FromRepr)]
(#276)
This commit is contained in:
parent
0a0def76bd
commit
93ea44dd12
@ -16,7 +16,15 @@ pub fn from_repr_inner(ast: &DeriveInput) -> syn::Result<TokenStream> {
|
|||||||
for attr in attrs {
|
for attr in attrs {
|
||||||
let path = attr.path();
|
let path = attr.path();
|
||||||
|
|
||||||
let mut ts = attr.meta.require_list()?.to_token_stream().into_iter();
|
let mut ts = if let Ok(ts) = attr
|
||||||
|
.meta
|
||||||
|
.require_list()
|
||||||
|
.map(|metas| metas.to_token_stream().into_iter())
|
||||||
|
{
|
||||||
|
ts
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
// Discard the path
|
// Discard the path
|
||||||
let _ = ts.next();
|
let _ = ts.next();
|
||||||
let tokens: TokenStream = ts.collect();
|
let tokens: TokenStream = ts.collect();
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use strum::FromRepr;
|
use strum::FromRepr;
|
||||||
|
|
||||||
#[derive(Debug, FromRepr, PartialEq)]
|
#[derive(Debug, FromRepr, PartialEq)]
|
||||||
|
/// Day of the week
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
enum Week {
|
enum Week {
|
||||||
Sunday,
|
Sunday,
|
||||||
|
Loading…
Reference in New Issue
Block a user