polished-css-macros 0.1.0

Procedural macros which support the development of a library crate `polished-css`.
Documentation
use syn::{ItemImpl, Type};

use crate::utils::DataType;

pub fn get_data_type_from_item_impl(ast: &ItemImpl) -> DataType {
    let ident = match &*ast.self_ty {
        Type::Path(type_path) => {
            type_path
                .path
                .segments
                .last()
                .expect("Failed to get the last segment from type path")
                .ident
                .clone()
        }
        _ => panic!("Failed to access data type `impl` ident"),
    };
    DataType::get_from_ident(&ident)
}