Support printing lifetime generics on an impl-Trait block
[ldk-c-bindings] / c-bindings-gen / src / main.rs
index 9d6f9cfeadad7717594a5d878d19e2a0ac2a1af2..d490a8901d363b53b7f83481de7c9844aeb6e20a 100644 (file)
@@ -559,7 +559,9 @@ fn writeln_trait<'a, 'b, W: std::io::Write>(w: &mut W, t: &'a syn::ItemTrait, ty
        // Finally, implement the original Rust trait for the newly created mapped trait.
        writeln!(w, "\nuse {}::{} as rust{};", types.module_path, t.ident, trait_name).unwrap();
        if implementable {
-               write!(w, "impl rust{}", t.ident).unwrap();
+               write!(w, "impl").unwrap();
+               maybe_write_lifetime_generics(w, &t.generics, types);
+               write!(w, " rust{}", t.ident).unwrap();
                maybe_write_generics(w, &t.generics, types, false);
                writeln!(w, " for {} {{", trait_name).unwrap();
                impl_trait_for_c!(t, "", types);