Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.0.124 #128

Merged
merged 18 commits into from
Sep 4, 2024
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
fefaed2
Stop relying on `impl Deref { type Target = Self; ...`
TheBlueMatt Aug 20, 2024
358152b
Handle printing generic bounds on a trait impl better
TheBlueMatt Aug 22, 2024
3f6f425
Allow functions being mapped to be `const`
TheBlueMatt Aug 26, 2024
f7f26a1
Support serialization impls defined in a diff module from the type
TheBlueMatt Aug 26, 2024
26d603f
Add a `*Ref` struct for traits and `Deref` to it rather than `Self`
TheBlueMatt Aug 26, 2024
f0603d5
impl `Send`/`Sync`/`Deref`/deref method for opaque wrapper structs
TheBlueMatt Aug 26, 2024
5deb00b
Ensure we use the in-crate type for traits returning references
TheBlueMatt Aug 26, 2024
c4f2096
Handle writing Rust types for single-impl traits
TheBlueMatt Aug 26, 2024
a86b1d7
Use native types when converting for for single-impl traits
TheBlueMatt Aug 26, 2024
2850baa
Print ref conversion in `write_(from|to)_c_conversion_to_ref_prefix`
TheBlueMatt Aug 26, 2024
42aa74f
Don't attempt to check if a reference is clonable
TheBlueMatt Aug 26, 2024
b0f49d1
Disable lto in release macOS builds as they no longer work
TheBlueMatt Sep 3, 2024
27d607a
New crates/features and upgrade dependencies (removing `core2`!)
TheBlueMatt Aug 26, 2024
cd3afd2
Update hard-coded type resolution for new LDK and rust-bitcoin
TheBlueMatt Aug 26, 2024
b2a8999
Update manually-written bindings types to latest rust-bitcoin API
TheBlueMatt Aug 26, 2024
803f0d6
Update C++ demo to latest LDK API
TheBlueMatt Aug 26, 2024
65c08a4
Update branch references to LDK 0.0.124-bindings
TheBlueMatt Sep 3, 2024
f514913
Update auto-generated bindings to LDK 0.0.124
TheBlueMatt Sep 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Handle writing Rust types for single-impl traits
Single-impl traits which are marked no-export (like
`AChannelManager` in LDK) are mapped as the singular implementing
type, rather than a full-blown trait.

Here we handle this case when writing Rust objects (generally used
in writing generic bounds).
  • Loading branch information
TheBlueMatt committed Sep 3, 2024
commit c4f2096c26abaa92505602604ca6e71c36c76817
18 changes: 15 additions & 3 deletions c-bindings-gen/src/types.rs
Original file line number Diff line number Diff line change
@@ -1983,11 +1983,19 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
// the original crate.
write!(w, "{}", self.real_rust_type_mapping(&resolved)).unwrap();
} else {
if let Some(trait_impls) = self.crate_types.traits_impld.get(&resolved) {
if self.crate_types.traits.get(&resolved).is_none() && trait_impls.len() == 1 {
write!(w, "crate::{}", trait_impls[0]).unwrap();
return;
}
}
write!(w, "crate::{}", resolved).unwrap();
}
}
if let syn::PathArguments::AngleBracketed(args) = &path.segments.iter().last().unwrap().arguments {
self.write_rust_generic_arg(w, generics_resolver, args.args.iter(), with_ref_lifetime);
if !generated_crate_ref {
if let syn::PathArguments::AngleBracketed(args) = &path.segments.iter().last().unwrap().arguments {
self.write_rust_generic_arg(w, generics_resolver, args.args.iter(), with_ref_lifetime);
}
}
} else {
if path.leading_colon.is_some() {
@@ -2051,7 +2059,11 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
}
if let Some(resolved_ty) = self.maybe_resolve_path(&p.path, generics) {
generate_crate_ref |= self.maybe_resolve_path(&p.path, None).as_ref() != Some(&resolved_ty);
if self.crate_types.traits.get(&resolved_ty).is_none() { generate_crate_ref = false; }
let mut is_trait = self.crate_types.traits.get(&resolved_ty).is_some();
is_trait |= self.crate_types.traits_impld.get(&resolved_ty).is_some();
if !is_trait {
generate_crate_ref = false;
}
}
self.write_rust_path(w, generics, &p.path, with_ref_lifetime, generate_crate_ref);
},