structs implementing Copy are scaffolded out.

todo: need an unsafe method for casting pointers in order to validate
contents via recursive descent
This commit is contained in:
Pat Hickey
2020-01-28 15:45:52 -08:00
parent 373560b88a
commit 62e00434b0
6 changed files with 113 additions and 6 deletions

View File

@@ -10,7 +10,12 @@ pub fn define_module_trait(names: &Names, m: &Module) -> TokenStream {
let funcname = names.func(&f.name);
let args = f.params.iter().map(|arg| {
let arg_name = names.func_param(&arg.name);
let arg_type = names.type_ref(&arg.tref);
let arg_typename = names.type_ref(&arg.tref);
let arg_type = match arg.tref.type_().passed_by() {
witx::TypePassedBy::Value { .. } => quote!(#arg_typename),
witx::TypePassedBy::Pointer { .. } => quote!(&#arg_typename),
witx::TypePassedBy::PointerLengthPair { .. } => unimplemented!(),
};
quote!(#arg_name: #arg_type)
});
let rets = f