Skip to content

Commit 8f4db29

Browse files
committed
impl DerefMut for all traits
This is sometimes required in LDK now, and there's no real reason not to implement it.
1 parent 3ddf30c commit 8f4db29

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

c-bindings-gen/src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,8 @@ fn writeln_trait<'a, 'b, W: std::io::Write>(w: &mut W, t: &'a syn::ItemTrait, ty
647647
writeln!(w, "// directly as a Deref trait in higher-level structs:").unwrap();
648648
writeln!(w, "impl core::ops::Deref for {} {{\n\ttype Target = Self;", trait_name).unwrap();
649649
writeln!(w, "\tfn deref(&self) -> &Self {{\n\t\tself\n\t}}\n}}").unwrap();
650+
writeln!(w, "impl core::ops::DerefMut for {} {{", trait_name).unwrap();
651+
writeln!(w, "\tfn deref_mut(&mut self) -> &mut Self {{\n\t\tself\n\t}}\n}}").unwrap();
650652
}
651653

652654
writeln!(w, "/// Calls the free function if one is set").unwrap();

0 commit comments

Comments
 (0)