]> git.bitcoin.ninja Git - ldk-c-bindings/log
ldk-c-bindings
20 months agoAdd `lightning-background-processor`'s new std feature
Matt Corallo [Fri, 3 Mar 2023 02:04:32 +0000 (02:04 +0000)]
Add `lightning-background-processor`'s new std feature

20 months agoSupport new rust-bitcoin type mappings for various hashes
Matt Corallo [Mon, 27 Feb 2023 21:45:53 +0000 (21:45 +0000)]
Support new rust-bitcoin type mappings for various hashes

20 months agoIgnore discriminants on enum variants
Matt Corallo [Mon, 27 Feb 2023 21:45:29 +0000 (21:45 +0000)]
Ignore discriminants on enum variants

While this loses the value information, its better than failing to
generate bindings at all.

20 months agoSupport tuples containing array elements
Matt Corallo [Tue, 28 Feb 2023 23:31:11 +0000 (23:31 +0000)]
Support tuples containing array elements

20 months agoAdd type for 8 u16s (which is used for the scoring data)
Matt Corallo [Tue, 28 Feb 2023 23:25:38 +0000 (23:25 +0000)]
Add type for 8 u16s (which is used for the scoring data)

20 months agoSupport non-u8 (primitive) arrays
Matt Corallo [Tue, 28 Feb 2023 23:25:26 +0000 (23:25 +0000)]
Support non-u8 (primitive) arrays

20 months agoSupport supertraits-of-supertraits
Matt Corallo [Mon, 27 Feb 2023 21:25:27 +0000 (21:25 +0000)]
Support supertraits-of-supertraits

If we have a supertrait that requires an in-crate supertrait, we
handle that here by writing the required impls. We don't support
a supertrait-of-a-supertrait-of-a-supertrait.

20 months agoFix typo in path resolution leading to a "crate name" of a full path
Matt Corallo [Mon, 27 Feb 2023 21:45:14 +0000 (21:45 +0000)]
Fix typo in path resolution leading to a "crate name" of a full path

20 months agoSupport passing `Option<&OpaqueStruct>` to C
Matt Corallo [Mon, 27 Feb 2023 18:51:59 +0000 (18:51 +0000)]
Support passing `Option<&OpaqueStruct>` to C

Luckily the solution is trivial - just treat the conversion for the
inner pointer as `ptr_for_ref`, because we ultimately want a
pointer on the inside, not on the outside.

22 months agoMerge pull request #98 from TheBlueMatt/main v0.0.113.1
Matt Corallo [Fri, 13 Jan 2023 06:12:12 +0000 (06:12 +0000)]
Merge pull request #98 from TheBlueMatt/main

Fix OSX building by not redirecting to `/dev/null`

22 months agoFix OSX building by not redirecting to `/dev/null`
Matt Corallo [Fri, 13 Jan 2023 06:09:30 +0000 (06:09 +0000)]
Fix OSX building by not redirecting to `/dev/null`

Somehow this results in a broken pipe error...cause macOS is trash.

22 months agoMerge pull request #97 from TheBlueMatt/main
Matt Corallo [Fri, 13 Jan 2023 04:12:57 +0000 (04:12 +0000)]
Merge pull request #97 from TheBlueMatt/main

Fix LTO compilation with latest ld.lld on OSX

22 months agoStop timing C++ demo bindings run cause OSX is, as usual, garbage
Matt Corallo [Fri, 13 Jan 2023 03:34:59 +0000 (03:34 +0000)]
Stop timing C++ demo bindings run cause OSX is, as usual, garbage

22 months agoUpdate CI references to OSX clang 15.0.3
Matt Corallo [Thu, 12 Jan 2023 23:28:27 +0000 (23:28 +0000)]
Update CI references to OSX clang 15.0.3

22 months agoFix LTO compilation with latest ld.lld on OSX
Matt Corallo [Thu, 12 Jan 2023 23:27:19 +0000 (23:27 +0000)]
Fix LTO compilation with latest ld.lld on OSX

22 months agoMerge pull request #96 from TheBlueMatt/main v0.0.113.0
Matt Corallo [Tue, 10 Jan 2023 20:24:45 +0000 (20:24 +0000)]
Merge pull request #96 from TheBlueMatt/main

0.0.113 Bindings

22 months agoUpdate CI and Cargo.toml references to 0.0.113
Matt Corallo [Tue, 10 Jan 2023 17:43:53 +0000 (17:43 +0000)]
Update CI and Cargo.toml references to 0.0.113

22 months agoSet the C target to wasm32-wasi rather than wasm32
Matt Corallo [Sat, 24 Dec 2022 18:14:37 +0000 (18:14 +0000)]
Set the C target to wasm32-wasi rather than wasm32

We need at least a partial C stdlib anyway, so there's no real
difference going ahead and linking wasm32-wasi on the C side vs
only on the Rust side. This fixes compilation on Debian testing
with OS packages installed.

22 months agoUpdate C/C++ demo bindings to latest upstream API
Matt Corallo [Fri, 23 Dec 2022 20:14:01 +0000 (20:14 +0000)]
Update C/C++ demo bindings to latest upstream API

22 months agoUpdate auto-generated bindings to 0.0.113
Matt Corallo [Fri, 23 Dec 2022 20:25:40 +0000 (20:25 +0000)]
Update auto-generated bindings to 0.0.113

22 months agoSupport new upstream manually-mapped types
Matt Corallo [Fri, 23 Dec 2022 20:24:00 +0000 (20:24 +0000)]
Support new upstream manually-mapped types

22 months agoAdd support for witnesses via a manual mapping
Matt Corallo [Sat, 24 Dec 2022 01:14:33 +0000 (01:14 +0000)]
Add support for witnesses via a manual mapping

22 months agoSupport u128 values
Matt Corallo [Fri, 23 Dec 2022 20:23:16 +0000 (20:23 +0000)]
Support u128 values

23 months agoUse the resolved name, not original ident, for Vec naming
Matt Corallo [Sat, 24 Dec 2022 22:57:55 +0000 (22:57 +0000)]
Use the resolved name, not original ident, for Vec naming

This will be useful in the next commit when we rename `u5` to `U5`

23 months agoIgnore async functions as mapping them would be substantial work
Matt Corallo [Sat, 24 Dec 2022 05:01:45 +0000 (05:01 +0000)]
Ignore async functions as mapping them would be substantial work

23 months agoAllow enums with lifetime-only generics
Matt Corallo [Sat, 24 Dec 2022 05:01:25 +0000 (05:01 +0000)]
Allow enums with lifetime-only generics

23 months agoUse `Clone::clone(a)` rather than `a.clone` to avoid deref recursion
Matt Corallo [Sat, 24 Dec 2022 22:57:17 +0000 (22:57 +0000)]
Use `Clone::clone(a)` rather than `a.clone` to avoid deref recursion

23 months agoSome initial support for `pub(.*) use` aliasing in type resolution
Matt Corallo [Fri, 23 Dec 2022 20:18:34 +0000 (20:18 +0000)]
Some initial support for `pub(.*) use` aliasing in type resolution

2 years agoMake rustc stop complaining about unused `Box::from_raw`s
Matt Corallo [Fri, 28 Oct 2022 21:14:28 +0000 (21:14 +0000)]
Make rustc stop complaining about unused `Box::from_raw`s

2 years agoMerge pull request #94 from TheBlueMatt/main v0.0.112.0
Matt Corallo [Fri, 28 Oct 2022 03:25:30 +0000 (03:25 +0000)]
Merge pull request #94 from TheBlueMatt/main

Update for 0.0.112

2 years agoUpdate Cargo.toml and CI references to 0.0.112
Matt Corallo [Thu, 27 Oct 2022 23:19:38 +0000 (23:19 +0000)]
Update Cargo.toml and CI references to 0.0.112

2 years agoUpdate auto-generated bindings
Matt Corallo [Thu, 27 Oct 2022 03:52:14 +0000 (03:52 +0000)]
Update auto-generated bindings

2 years agoUpdate C/C++ demos for latest upstream API
Matt Corallo [Thu, 27 Oct 2022 00:24:49 +0000 (00:24 +0000)]
Update C/C++ demos for latest upstream API

2 years agoMap `io::ErrorKind` the same as `io::Error`, we only use the kind
Matt Corallo [Thu, 27 Oct 2022 00:21:21 +0000 (00:21 +0000)]
Map `io::ErrorKind` the same as `io::Error`, we only use the kind

2 years agoHandle path types that start with `crate::`
Matt Corallo [Thu, 27 Oct 2022 00:20:38 +0000 (00:20 +0000)]
Handle path types that start with `crate::`

2 years agoHandle multiple `impl`s of the same trait in the same file
Matt Corallo [Thu, 27 Oct 2022 00:18:18 +0000 (00:18 +0000)]
Handle multiple `impl`s of the same trait in the same file

This should be easy, but we end up with redundant `use` statements.
Thus, we instead track which use statements we want and put them at
the end when generating new files

2 years ago(Partially) support supertraits with generic bounds
Matt Corallo [Thu, 27 Oct 2022 00:15:31 +0000 (00:15 +0000)]
(Partially) support supertraits with generic bounds

If we extend a supertrait where the supertrait is generic, we will
ultimately need to genericize the supertrait into a derived object.
This doesn't implement that part, but it does implement the
subtrait-writing code to make it compatible with such a future.

2 years agoSupport trait methods that return enums in the C++ sed script
Matt Corallo [Thu, 27 Oct 2022 00:08:55 +0000 (00:08 +0000)]
Support trait methods that return enums in the C++ sed script

2 years agoMerge pull request #93 from TheBlueMatt/main
Arik [Thu, 6 Oct 2022 20:24:44 +0000 (13:24 -0700)]
Merge pull request #93 from TheBlueMatt/main

Expose the `rapid-gossip-sync` crate for no-std builds

2 years agoUpdate auto-generated bindings for backport of RGS-no-std support
Matt Corallo [Thu, 6 Oct 2022 00:44:02 +0000 (00:44 +0000)]
Update auto-generated bindings for backport of RGS-no-std support

2 years agoExpose the `rapid-gossip-sync` crate for no-std builds
Matt Corallo [Thu, 6 Oct 2022 00:11:11 +0000 (00:11 +0000)]
Expose the `rapid-gossip-sync` crate for no-std builds

2 years agoMerge pull request #92 from TheBlueMatt/main v0.0.111.0
Arik [Mon, 3 Oct 2022 21:22:28 +0000 (14:22 -0700)]
Merge pull request #92 from TheBlueMatt/main

Add a convinience constructor for the new BigEndianScalar

2 years agoUpdate auto-generated bindings
Matt Corallo [Mon, 3 Oct 2022 21:20:59 +0000 (21:20 +0000)]
Update auto-generated bindings

2 years agoAdd a convinience constructor for the new BigEndianScalar
Matt Corallo [Mon, 3 Oct 2022 21:15:58 +0000 (21:15 +0000)]
Add a convinience constructor for the new BigEndianScalar

2 years agoMerge pull request #91 from TheBlueMatt/main
Arik [Mon, 3 Oct 2022 21:14:38 +0000 (14:14 -0700)]
Merge pull request #91 from TheBlueMatt/main

0.0.111

2 years agoUpdate auto-generated bindings
Matt Corallo [Mon, 19 Sep 2022 15:18:31 +0000 (15:18 +0000)]
Update auto-generated bindings

2 years agoUpdate C++ bindings demo to latest upstream API
Matt Corallo [Mon, 19 Sep 2022 10:44:47 +0000 (10:44 +0000)]
Update C++ bindings demo to latest upstream API

2 years agoAdd Scalar and SharedSecret type mappings for new secp256k1 types
Matt Corallo [Fri, 23 Sep 2022 20:47:17 +0000 (20:47 +0000)]
Add Scalar and SharedSecret type mappings for new secp256k1 types

2 years agoUpdate bindings branch to 0.0.111 and update rust-bitcoin and secp
Matt Corallo [Mon, 19 Sep 2022 14:56:41 +0000 (14:56 +0000)]
Update bindings branch to 0.0.111 and update rust-bitcoin and secp

2 years agoAllow liftime bounds on generic bounds
Matt Corallo [Mon, 19 Sep 2022 12:51:02 +0000 (12:51 +0000)]
Allow liftime bounds on generic bounds

While liftime bounds require bindings users to ensure liftime
requirements are met, they're important for allowing us to export
lock wrappers. Thus, we relax the simple-bounds assertions checks
here.

2 years agoDon't use a turbofish when all parameters are lifetimes.
Matt Corallo [Fri, 23 Sep 2022 18:57:13 +0000 (18:57 +0000)]
Don't use a turbofish when all parameters are lifetimes.

For some reason rustc doesn't like this, and its easy, so whatever.

2 years agoUse trait, not impl, definition for X_as_Trait functions
Matt Corallo [Fri, 23 Sep 2022 16:18:55 +0000 (16:18 +0000)]
Use trait, not impl, definition for X_as_Trait functions

When we map a trait impl block, we historically didn't know how to
resolve the types in the trait context, so we just used the impl
context definitions and assumed the types were the same. Sadly, if
we have an associated type that is bounded by a trait, we need to
use the trait bound to figure out what to write for the X_as_Trait
method declarations.

Since we now have the ability to generate full trait-context type
resolvers, we do so here.

2 years agoSupport mapping `Readable` `impl`s outside of the `lightning` crate
Matt Corallo [Mon, 19 Sep 2022 10:16:38 +0000 (10:16 +0000)]
Support mapping `Readable` `impl`s outside of the `lightning` crate

In order to map `Readable` `impl` blocks in crates other than the
`lightning` main crate we simply have to update the type references
to include crate name, which we do here.

2 years agoPrefer `Option_` mappings for more types over transparent mappings
Matt Corallo [Fri, 23 Sep 2022 16:12:46 +0000 (16:12 +0000)]
Prefer `Option_` mappings for more types over transparent mappings

In general, the explicit `Option_` mappings are easier for
downstream bindings to match against, and clearer for users anyway.
Sadly, originally we were trying to avoid them where possible, so
some types default to transparent mappings. Here we swap the
default, at least for manually-mapped types, with a few explicit
exceptions (that probably should be changed as well).

2 years agoMerge pull request #89 from TheBlueMatt/main v0.0.110.1
Matt Corallo [Thu, 4 Aug 2022 23:37:06 +0000 (23:37 +0000)]
Merge pull request #89 from TheBlueMatt/main

Don't force targeting sandybridge on all platforms

2 years agoDon't force targeting sandybridge on all platforms
Matt Corallo [Thu, 4 Aug 2022 18:51:08 +0000 (18:51 +0000)]
Don't force targeting sandybridge on all platforms

This should fix building on macOS when using upstream clang.

2 years agoMerge pull request #88 from TheBlueMatt/main
Matt Corallo [Thu, 4 Aug 2022 03:56:05 +0000 (03:56 +0000)]
Merge pull request #88 from TheBlueMatt/main

Try clone'ing the field before skipping exporting a field getter

2 years agoUpdate auto-generated bindings
Matt Corallo [Wed, 3 Aug 2022 22:35:21 +0000 (22:35 +0000)]
Update auto-generated bindings

2 years agoTry clone'ing the field before skipping exporting a field getter
Matt Corallo [Wed, 3 Aug 2022 22:29:19 +0000 (22:29 +0000)]
Try clone'ing the field before skipping exporting a field getter

2 years agoMerge pull request #87 from TheBlueMatt/main v0.0.110.0
Matt Corallo [Wed, 27 Jul 2022 06:25:06 +0000 (06:25 +0000)]
Merge pull request #87 from TheBlueMatt/main

LDK 0.0.110

2 years agoUpdate auto-generated bindings to LDK 0.0.110
Matt Corallo [Wed, 27 Jul 2022 05:02:27 +0000 (05:02 +0000)]
Update auto-generated bindings to LDK 0.0.110

2 years agoUpdate lightning-c-bindings Cargo and CI to reference 0.0.110
Matt Corallo [Wed, 27 Jul 2022 05:02:54 +0000 (05:02 +0000)]
Update lightning-c-bindings Cargo and CI to reference 0.0.110

2 years agoUpdate C/C++ demos to latest upstream API
Matt Corallo [Wed, 27 Jul 2022 04:50:43 +0000 (04:50 +0000)]
Update C/C++ demos to latest upstream API

2 years agoMerge pull request #84 from TheBlueMatt/main v0.0.109.0
Matt Corallo [Fri, 1 Jul 2022 21:41:47 +0000 (14:41 -0700)]
Merge pull request #84 from TheBlueMatt/main

0.0.109 Support

2 years agoUpdate lightning-c-bindings Cargo.toml and CI to 0.0.109
Matt Corallo [Fri, 1 Jul 2022 20:34:28 +0000 (20:34 +0000)]
Update lightning-c-bindings Cargo.toml and CI to 0.0.109

2 years agoUpdate auto-generated C bindings for 0.0.109
Matt Corallo [Fri, 1 Jul 2022 20:29:21 +0000 (20:29 +0000)]
Update auto-generated C bindings for 0.0.109

2 years agoUpdate demo.cpp to 0.0.109 API
Matt Corallo [Fri, 1 Jul 2022 20:28:48 +0000 (20:28 +0000)]
Update demo.cpp to 0.0.109 API

2 years agoSupport `&[[u8; N]]` passed to Rust.
Matt Corallo [Fri, 1 Jul 2022 20:08:13 +0000 (20:08 +0000)]
Support `&[[u8; N]]` passed to Rust.

2 years agoSupport `Option<Tuple>` with elements in the tuple
Matt Corallo [Fri, 1 Jul 2022 18:57:51 +0000 (18:57 +0000)]
Support `Option<Tuple>` with elements in the tuple

2 years agoMerge pull request #83 from TheBlueMatt/main v0.0.108.2
Matt Corallo [Wed, 29 Jun 2022 22:03:22 +0000 (15:03 -0700)]
Merge pull request #83 from TheBlueMatt/main

Update `deterministic-build-wrappers` to include a rapid-gossip-sync match

2 years agoUpdate `deterministic-build-wrappers` to include a rapid-gossip-sync match
Matt Corallo [Wed, 29 Jun 2022 22:02:16 +0000 (22:02 +0000)]
Update `deterministic-build-wrappers` to include a rapid-gossip-sync match

2 years agoMerge pull request #82 from TheBlueMatt/main v0.0.108.1
Matt Corallo [Wed, 29 Jun 2022 18:35:53 +0000 (11:35 -0700)]
Merge pull request #82 from TheBlueMatt/main

0.0.108.1

2 years agoUpdate auto-generated bindings to match latest 0.0.108-bindings
Matt Corallo [Wed, 29 Jun 2022 17:56:11 +0000 (17:56 +0000)]
Update auto-generated bindings to match latest 0.0.108-bindings

2 years agoUpdate demo.cpp to match updated 0.0.108-bindings API
Matt Corallo [Wed, 29 Jun 2022 17:55:27 +0000 (17:55 +0000)]
Update demo.cpp to match updated 0.0.108-bindings API

2 years agoMerge pull request #81 from TheBlueMatt/main v0.0.108.0
Matt Corallo [Tue, 28 Jun 2022 21:57:11 +0000 (14:57 -0700)]
Merge pull request #81 from TheBlueMatt/main

0.0.108 Bindings Updates

2 years agoFix cbindgen install to be MSRV-compatible with older hashbrown
Matt Corallo [Tue, 28 Jun 2022 00:42:43 +0000 (00:42 +0000)]
Fix cbindgen install to be MSRV-compatible with older hashbrown

2 years agoUpdate auto-generated bindings
Matt Corallo [Thu, 23 Jun 2022 03:13:16 +0000 (03:13 +0000)]
Update auto-generated bindings

2 years agoUpdate C/C++ demos to latest upstream API
Matt Corallo [Thu, 23 Jun 2022 03:02:48 +0000 (03:02 +0000)]
Update C/C++ demos to latest upstream API

2 years agoUpdate lightning-c-bindings Cargo.toml and CI to 0.0.108-bindings
Matt Corallo [Thu, 23 Jun 2022 03:13:52 +0000 (03:13 +0000)]
Update lightning-c-bindings Cargo.toml and CI to 0.0.108-bindings

2 years agoAdd rapid gossip sync crate to generation in `std` mode.
Matt Corallo [Wed, 22 Jun 2022 18:58:18 +0000 (18:58 +0000)]
Add rapid gossip sync crate to generation in `std` mode.

2 years agoAdd locally defined crates as "dependencies" without `extern crate`
Matt Corallo [Wed, 22 Jun 2022 19:59:45 +0000 (19:59 +0000)]
Add locally defined crates as "dependencies" without `extern crate`

We later use the `dependency` set when doing type resolution to
decide if `::asdf::T` means `current_crate::asdf::T` or `asdf::T`,
which will resolve incorrectly if we don't ensure all possible
crates are in the `dependencies` list.

2 years agoSupport `Option<Trait>` (and `Option<&Trait>`, implemented the same)
Matt Corallo [Wed, 22 Jun 2022 03:48:04 +0000 (03:48 +0000)]
Support `Option<Trait>` (and `Option<&Trait>`, implemented the same)

2 years agoUse new `Type`-based resolution to decide if a container is transparent
Matt Corallo [Wed, 22 Jun 2022 02:36:09 +0000 (02:36 +0000)]
Use new `Type`-based resolution to decide if a container is transparent

We also assert that we were able to resolve paths inside containers
as we shouldn't be deciding if a container is transparent without
all the context.

2 years agoUse new `Type`-based generic resolution in `write_rust_path`
Matt Corallo [Sat, 18 Jun 2022 19:39:59 +0000 (19:39 +0000)]
Use new `Type`-based generic resolution in `write_rust_path`

This gives us better generic resolution, but because we determine
whether to include a `crate::` prefix or not based on generic
resolution it means we have to pipe through the "type is a generic that
was resolved" flag from `write_rust_type`. We also take this opporunity
to do better decision making for the `crate::` prefix entirely, which
is important for enums that contain trait instances.

2 years agoPass `with_ref_lifetime` through to rust-type-printing from C-path printing
Matt Corallo [Fri, 17 Jun 2022 21:01:14 +0000 (21:01 +0000)]
Pass `with_ref_lifetime` through to rust-type-printing from C-path printing

If we get to `write_c_path_intern` with `c_ty` unset, we delegate to
`write_rust_path`, however it would lose the `with_ref_lifetime`
flag, causing us to miss `'static` when printing references in
generic arguments. Here we simply pipe it through.

2 years agoCheck whether the fields of an enum are clonable before implementing clone
Matt Corallo [Fri, 17 Jun 2022 21:00:39 +0000 (21:00 +0000)]
Check whether the fields of an enum are clonable before implementing clone

2 years agoDo a second initial-walk pass to apply clonable flags to aliases
Matt Corallo [Fri, 17 Jun 2022 21:00:13 +0000 (21:00 +0000)]
Do a second initial-walk pass to apply clonable flags to aliases

This enables the clonable flags for `*Features`.

2 years agoMove code to map aliased types into a virtual impl block into a helper
Matt Corallo [Fri, 24 Jun 2022 01:15:53 +0000 (01:15 +0000)]
Move code to map aliased types into a virtual impl block into a helper

This will allow us to create virtual impl blocks during the early
code passes before we go to do the full conversion pass.

2 years agoGenerate mutable references in `default_generics` when relevant
Matt Corallo [Thu, 23 Jun 2022 16:13:06 +0000 (16:13 +0000)]
Generate mutable references in `default_generics` when relevant

As we move towards resolving generics via the new `Type`-based
interface instead of the string-based one, we need to ensure we
retain the mutability flag when resolving references, which we do
here.

2 years agoMove overly-specific check to an assertion where its relevant
Matt Corallo [Thu, 2 Jun 2022 20:40:54 +0000 (20:40 +0000)]
Move overly-specific check to an assertion where its relevant

2 years agoDo not make `Deref<T>` generic params always a `&T` for traits.
Matt Corallo [Fri, 24 Jun 2022 01:20:33 +0000 (01:20 +0000)]
Do not make `Deref<T>` generic params always a `&T` for traits.

We never expect traits to be passed by reference, so when using
the new-style generic resolution, we shouldn't force all `Deref`s
to `&T`, at least if the `T` is a trait.

2 years agoPrint field documentation even for unnamed enum variant fields
Matt Corallo [Tue, 28 Jun 2022 02:17:18 +0000 (02:17 +0000)]
Print field documentation even for unnamed enum variant fields

2 years agoAdd a note in output documentation for fields with refs to opaques
Matt Corallo [Tue, 28 Jun 2022 02:14:20 +0000 (02:14 +0000)]
Add a note in output documentation for fields with refs to opaques

Because we (probably shouldn't, but do) map "opaque" structs with
an `is_owned` field instead of having a dedicated reference type,
fields which are a `Deref<Struct>` are simply mapped as
`OpaqueMappedStruct`. This is confusing for downstream `lightning.h`
consumers as they cannot differentiate between a field that expects
to own a `Struct` and one which expects to own a reference to it.

This is worked around here by adding documentation which can be
matched on, though ultimately structs should move towards full
ownership.

2 years agoSet `ptr_for_ref` correctly when writing conversions for enum fields
Matt Corallo [Fri, 24 Jun 2022 01:19:59 +0000 (01:19 +0000)]
Set `ptr_for_ref` correctly when writing conversions for enum fields

2 years agoCorrectly set the `ptr_for_ref` arg on `write_c_type` calls in enum printing
Matt Corallo [Fri, 24 Jun 2022 01:16:46 +0000 (01:16 +0000)]
Correctly set the `ptr_for_ref` arg on `write_c_type` calls in enum printing

This avoids adding references to opaque structs in enum fields,
where we should, of course, map them as owned opaque structs.

It does generate some difficult-to-parse-by-downstream-bindings
code, which is addressed in a later commit by adding documentation.

Note that it also relies on the types being mapped differently
being opaque as it now needs logic to map a reference to a
non-reference with `is_owned` unset.

2 years agoCorrectly define the `native` type alias for enums with generic params
Matt Corallo [Fri, 24 Jun 2022 01:18:00 +0000 (01:18 +0000)]
Correctly define the `native` type alias for enums with generic params

2 years agoCorrectly generate `impl` blocks for traits with generics
Matt Corallo [Fri, 24 Jun 2022 01:15:31 +0000 (01:15 +0000)]
Correctly generate `impl` blocks for traits with generics

2 years agoSupport `T: Deref...where` in underlying structs from type aliases
Matt Corallo [Thu, 2 Jun 2022 20:39:47 +0000 (20:39 +0000)]
Support `T: Deref...where` in underlying structs from type aliases

2 years agoHandle trait methods with a default implementation
Matt Corallo [Thu, 23 Jun 2022 16:03:06 +0000 (16:03 +0000)]
Handle trait methods with a default implementation

This does not currently expose the default implementation to users
who wish to avoid manually implementing the method.

2 years agoInclude the `where` clause from a "real" type when mapping type aliases
Matt Corallo [Mon, 30 May 2022 23:51:54 +0000 (23:51 +0000)]
Include the `where` clause from a "real" type when mapping type aliases

ie if we have a
```
struct A<T: Deref> where T::Target: Trait {}
pub type B<T> = A<T>;
```

this includes the `where` clause so that we end up calling
`writeln_opaque` for `struct B<T: Deref> where T::Target: Trait {}`
instead of `struct B<T: Deref> {}`.