@@ -19,12 +19,13 @@ type getting an `LDK` prefix to their native Rust type names.
19
19
Structs are mapped into a simple wrapper containing a pointer to the native Rust-Lightning object
20
20
and a flag to indicate whether the object is owned or only a reference. Such mappings usually
21
21
generate a ` X_free ` function which must be called to release the allocated resources. Note that
22
- calling ` X_free ` will do nothing if the underlying pointer is NULL or if the reference flag is set.
22
+ calling ` X_free ` will do nothing if the underlying pointer is NULL or if the ` is_owned ` flag is not
23
+ set.
23
24
24
25
You MUST NOT create such wrapper structs manually, relying instead on constructors which have been
25
26
mapped from equivalent Rust constructors.
26
27
27
- Note that, thanks to the is-reference flag and the pointer being NULLable, such structs effectively
28
+ Note that, thanks to the is-owned flag and the pointer being NULLable, such structs effectively
28
29
represent ` RustType ` , ` &RustType ` , and ` Option<RustType> ` . Check the corresponding Rust
29
30
documentation for the function or struct you are using to ensure you use the correct call semantics.
30
31
The passed struct must match the call semantics or an assertion failure or NULL pointer dereference
@@ -35,7 +36,7 @@ For example, this is the mapping of ChannelManager.
35
36
typedef struct MUST_USE_STRUCT LDKChannelManager {
36
37
/** ... * /
37
38
LDKnativeChannelManager * inner;
38
- bool _ underlying_ref ;
39
+ bool is_owned ;
39
40
} LDKChannelManager;
40
41
```
41
42
@@ -141,10 +142,10 @@ as their first argument. Free-standing functions are mapped simply as `function_
141
142
relevant mapped type arguments.
142
143
143
144
Functions which return ` &OpaqueRustType ` and which return ` OpaqueRustType ` are both mapped to a
144
- function returning an owned wrapper struct. The ` _underlying_ref ` flag (see above) will be set to
145
- indicate that the pointed-to Rust object is owned or only a reference. Thus, when implementing a
146
- function which Rust will call or calling a Rust function, you should check the Rust documentation
147
- for the function to determine whether an owned or referenced object is expected or returned.
145
+ function returning an owned wrapper struct. The ` is_owned ` flag (see above) will be set to indicate
146
+ that the pointed-to Rust object is owned or only a reference. Thus, when implementing a function
147
+ which Rust will call or calling a Rust function, you should check the Rust documentation for the
148
+ function to determine whether an owned or referenced object is expected or returned.
148
149
149
150
Similarly, when a function takes an ` Option<RustType> ` as a parameter or a return value, the C type
150
151
is the same as if it took only ` RustType ` , with the ` inner ` field set to NULL to indicate None. For
0 commit comments