athene_macro 0.3.5

Macro generation for athene
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use proc_macro2::Ident;
use syn::{Error, ItemImpl, Result, Type};

pub fn parse_item_impl_ident(input: &ItemImpl) -> Result<&Ident> {
    if let Type::Path(p) = input.self_ty.as_ref() {
        if let Some(f) = p.path.segments.first() {
            return Ok(&f.ident);
        }
    }

    Err(Error::new_spanned(
        input,
        "Unable to parse impl ident. this is fatal",
    ))
}