Skip to content

Commit f180d14

Browse files
committed
Support mapping Readable impls outside of the lightning crate
In order to map `Readable` `impl` blocks in crates other than the `lightning` main crate we simply have to update the type references to include crate name, which we do here.
1 parent c918954 commit f180d14

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

c-bindings-gen/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ fn maybe_convert_trait_impl<W: std::io::Write>(w: &mut W, trait_path: &syn::Path
102102
},
103103
"lightning::util::ser::Readable"|"lightning::util::ser::ReadableArgs"|"lightning::util::ser::MaybeReadable" => {
104104
// Create the Result<Object, DecodeError> syn::Type
105-
let mut res_ty: syn::Type = parse_quote!(Result<#for_ty, ::ln::msgs::DecodeError>);
105+
let mut res_ty: syn::Type = parse_quote!(Result<#for_ty, lightning::ln::msgs::DecodeError>);
106106

107107
writeln!(w, "#[no_mangle]").unwrap();
108108
writeln!(w, "/// Read a {} from a byte array, created by {}_write", for_obj, for_obj).unwrap();
@@ -151,7 +151,7 @@ fn maybe_convert_trait_impl<W: std::io::Write>(w: &mut W, trait_path: &syn::Path
151151
} else { unreachable!(); }
152152
} else { unreachable!(); }
153153
} else if t == "lightning::util::ser::MaybeReadable" {
154-
res_ty = parse_quote!(Result<Option<#for_ty>, ::ln::msgs::DecodeError>);
154+
res_ty = parse_quote!(Result<Option<#for_ty>, lightning::ln::msgs::DecodeError>);
155155
}
156156
write!(w, ") -> ").unwrap();
157157
types.write_c_type(w, &res_ty, Some(generics), false);

0 commit comments

Comments
 (0)