Skip to content

Commit 734c0a6

Browse files
committed
[bindings] Separate take_ptr and take_inner
It is confusing to have two utility methods on different classes of types which do two different, but related, things with the same name.
1 parent 78c2c48 commit 734c0a6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

c-bindings-gen/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ fn writeln_opaque<W: std::io::Write>(w: &mut W, ident: &syn::Ident, struct_name:
454454
writeln!(w, "#[allow(unused)]").unwrap();
455455
writeln!(w, "/// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy").unwrap();
456456
writeln!(w, "impl {} {{", struct_name).unwrap();
457-
writeln!(w, "\tpub(crate) fn take_ptr(mut self) -> *mut native{} {{", struct_name).unwrap();
457+
writeln!(w, "\tpub(crate) fn take_inner(mut self) -> *mut native{} {{", struct_name).unwrap();
458458
writeln!(w, "\t\tassert!(self.is_owned);").unwrap();
459459
writeln!(w, "\t\tlet ret = self.inner;").unwrap();
460460
writeln!(w, "\t\tself.inner = std::ptr::null_mut();").unwrap();

c-bindings-gen/src/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
550550

551551
// List of structs we map (possibly during processing of other files):
552552
"ln::features::InitFeatures" if is_ref => Some(".inner) }"),
553-
"ln::features::InitFeatures" if !is_ref => Some(".take_ptr()) }"),
553+
"ln::features::InitFeatures" if !is_ref => Some(".take_inner()) }"),
554554

555555
// List of traits we map (possibly during processing of other files):
556556
"crate::util::logger::Logger" => Some(""),
@@ -1410,7 +1410,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
14101410
|w, decl_type, _full_path, is_ref, _is_mut| match decl_type {
14111411
DeclType::StructImported if is_ref && ptr_for_ref => write!(w, ").inner }}").unwrap(),
14121412
DeclType::StructImported if is_ref => write!(w, ".inner }}").unwrap(),
1413-
DeclType::StructImported if !is_ref => write!(w, ".take_ptr()) }}").unwrap(),
1413+
DeclType::StructImported if !is_ref => write!(w, ".take_inner()) }}").unwrap(),
14141414
DeclType::MirroredEnum if is_ref => write!(w, ".to_native()").unwrap(),
14151415
DeclType::MirroredEnum => write!(w, ".into_native()").unwrap(),
14161416
DeclType::Trait(_) => {},

0 commit comments

Comments
 (0)