summaryrefslogtreecommitdiffstats
path: root/third_party/rust/thiserror-impl/src/span.rs
blob: c1237ddfc52de088af1945f3d065babd69a33ce1 (plain)
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,
        }
    }
}