impl `DerefMut` for all traits
[ldk-c-bindings] / c-bindings-gen / src / main.rs
index 9f3727d0486992ba15e8f2d0b7ebfb3a6b8e3080..8876583315246524ffb938df804234b9a2784d86 100644 (file)
@@ -647,6 +647,8 @@ fn writeln_trait<'a, 'b, W: std::io::Write>(w: &mut W, t: &'a syn::ItemTrait, ty
                writeln!(w, "// directly as a Deref trait in higher-level structs:").unwrap();
                writeln!(w, "impl core::ops::Deref for {} {{\n\ttype Target = Self;", trait_name).unwrap();
                writeln!(w, "\tfn deref(&self) -> &Self {{\n\t\tself\n\t}}\n}}").unwrap();
+               writeln!(w, "impl core::ops::DerefMut for {} {{", trait_name).unwrap();
+               writeln!(w, "\tfn deref_mut(&mut self) -> &mut Self {{\n\t\tself\n\t}}\n}}").unwrap();
        }
 
        writeln!(w, "/// Calls the free function if one is set").unwrap();