1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use proc_macro2::Span;
use syn::Member;

pub trait MemberSpan {
    fn member_span(&self) -> Span;
}

impl MemberSpan for Member {
    fn member_span(&self) -> Span {
        match self {
            Member::Named(ident) => ident.span(),
            Member::Unnamed(index) => index.span,
        }
    }
}