cglue-gen 0.2.0

FFI safe code generation for making plugins and C-compatible libraries
Documentation
use proc_macro2::TokenStream;
use quote::{format_ident, quote};
use std::collections::HashMap;
use syn::{Ident, Path};

pub fn get_impl(parent_path: &Path, out: &mut Vec<(Path, TokenStream)>) {
    let cur_path = super::super::join_paths(parent_path, format_ident!("clone"));

    out.push((
        cur_path,
        quote! {
            pub trait Clone {
                fn clone(&self) -> Self;
            }
        },
    ));
}

pub fn get_exports(parent_path: &Path, exports: &mut HashMap<Ident, Path>) {
    let cur_path = super::super::join_paths(parent_path, format_ident!("clone"));
    exports.insert(format_ident!("Clone"), cur_path);
}