X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=c-bindings-gen%2Fsrc%2Ftypes.rs;h=273899fa4730e8b9f46cffa19a1fd267add932fa;hb=7797d7c3c2d237ca8cbd31ba9a4611f80f647776;hp=a077d311b20afe647f669834686612e867a390d9;hpb=941d9997e687ef0fd41608651c4308745df8f157;p=rust-lightning diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index a077d311b..273899fa4 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -542,7 +542,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { // List of structs we map (possibly during processing of other files): "ln::features::InitFeatures" if is_ref => Some(".inner) }"), - "ln::features::InitFeatures" if !is_ref => Some(".take_ptr()) }"), + "ln::features::InitFeatures" if !is_ref => Some(".take_inner()) }"), // List of traits we map (possibly during processing of other files): "crate::util::logger::Logger" => Some(""), @@ -790,8 +790,8 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { match full_path { "Result" if !is_ref => { Some(("match ", - vec![(".result_ok { true => Ok(".to_string(), format!("(*unsafe {{ Box::from_raw({}.contents.result.take_ptr()) }})", var_name)), - ("), false => Err(".to_string(), format!("(*unsafe {{ Box::from_raw({}.contents.err.take_ptr()) }})", var_name))], + vec![(".result_ok { true => Ok(".to_string(), format!("(*unsafe {{ Box::from_raw(<*mut _>::take_ptr(&mut {}.contents.result)) }})", var_name)), + ("), false => Err(".to_string(), format!("(*unsafe {{ Box::from_raw(<*mut _>::take_ptr(&mut {}.contents.err)) }})", var_name))], ")}")) }, "Vec"|"Slice" if !is_ref => { @@ -1402,7 +1402,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { |w, decl_type, _full_path, is_ref, _is_mut| match decl_type { DeclType::StructImported if is_ref && ptr_for_ref => write!(w, ").inner }}").unwrap(), DeclType::StructImported if is_ref => write!(w, ".inner }}").unwrap(), - DeclType::StructImported if !is_ref => write!(w, ".take_ptr()) }}").unwrap(), + DeclType::StructImported if !is_ref => write!(w, ".take_inner()) }}").unwrap(), DeclType::MirroredEnum if is_ref => write!(w, ".to_native()").unwrap(), DeclType::MirroredEnum => write!(w, ".into_native()").unwrap(), DeclType::Trait(_) => {}, @@ -1847,7 +1847,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { self.crate_types.templates_defined.insert(mangled_container.clone(), true); let mut created_container: Vec = Vec::new(); - write!(&mut created_container, "#[no_mangle]\npub type {} = ", mangled_container).unwrap(); + write!(&mut created_container, "pub type {} = ", mangled_container).unwrap(); write!(&mut created_container, "{}::C{}Templ<", Self::container_templ_path(), container_type).unwrap(); self.write_template_generics(&mut created_container, &mut args.iter().map(|t| *t), generics, is_ref, true); writeln!(&mut created_container, ">;").unwrap();