From: Matt Corallo Date: Sun, 31 Oct 2021 18:13:00 +0000 (+0000) Subject: Support `use crate::*` statements X-Git-Tag: v0.0.103.0^2~10 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=14e40078699863ba8e15dbcfd2cd163ae67e5e5f;p=ldk-c-bindings Support `use crate::*` statements --- diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index 0cc4425..18f6a0c 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -410,6 +410,10 @@ impl<'mod_lifetime, 'crate_lft: 'mod_lifetime> ImportResolver<'mod_lifetime, 'cr for module in super_mod.split("::") { path.push(syn::PathSegment { ident: syn::Ident::new(module, Span::call_site()), arguments: syn::PathArguments::None }); } + } else if partial_path == "" && format!("{}", $ident) == "crate" { + new_path = format!("{}{}", crate_name, $path_suffix); + let crate_name_ident = format_ident!("{}", crate_name); + path.push(parse_quote!(#crate_name_ident)); } else if partial_path == "" && !dependencies.contains(&$ident) { new_path = format!("{}::{}{}", crate_name, $ident, $path_suffix); let crate_name_ident = format_ident!("{}", crate_name);