From 8f4db29a29bcce3b945f698ab81dee2306770832 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 26 Sep 2023 00:35:50 +0000 Subject: [PATCH] impl `DerefMut` for all traits This is sometimes required in LDK now, and there's no real reason not to implement it. --- c-bindings-gen/src/main.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/c-bindings-gen/src/main.rs b/c-bindings-gen/src/main.rs index 9f3727d..8876583 100644 --- a/c-bindings-gen/src/main.rs +++ b/c-bindings-gen/src/main.rs @@ -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(); -- 2.39.5