polished-css-macros 0.1.0

Procedural macros which support the development of a library crate `polished-css`.
Documentation
1
2
3
4
5
6
7
8
9
10
use syn::{Field, Ident, Type, TypePath};

pub fn get_last_path_segment(field: &Field) -> Option<&Ident> {
    if let Type::Path(TypePath { path, .. }) = &field.ty {
        if let Some(segment) = path.segments.last() {
            return Some(&segment.ident);
        }
    }
    None
}