GitBook: [main] 53 pages modified

This commit is contained in:
boneyard93501 2021-06-11 07:21:09 +00:00 committed by gitbook-bot
parent 2eaab36796
commit 0c270c551d
No known key found for this signature in database
GPG Key ID: 07D2180C7B12D0FF

View File

@ -102,8 +102,10 @@ Finally, the `[marine]` macro can wrap a `struct` making possible to use it as a
* all fields of the wrapped structure must be public and of the `ftype`. * all fields of the wrapped structure must be public and of the `ftype`.
* it is possible to have inner records in the macro-wrapped structure * it is possible to have inner records in the macro-wrapped structure
See the example below for a wrapped `struc`t: See the example below for a wrapped `struct` :
{% tabs %}
{% tab title="Example 1" %}
```rust ```rust
#[marine] #[marine]
pub struct TestRecord0 { pub struct TestRecord0 {
@ -127,6 +129,37 @@ pub struct TestRecord2 {
#[marine] #[marine]
fn foo(mut test_record: TestRecord2) -> TestRecord2 { unimplemented!(); } fn foo(mut test_record: TestRecord2) -> TestRecord2 { unimplemented!(); }
``` ```
{% endtab %}
{% tab title="Example 2" %}
```rust
#[fce]
pub struct TestRecord0 {
pub field_0: i32,
}
#[fce]
pub struct TestRecord1 {
pub field_0: i32,
pub field_1: String,
pub field_2: Vec<u8>,
pub test_record_0: TestRecord0,
}
#[fce]
pub struct TestRecord2 {
pub test_record_0: TestRecord0,
pub test_record_1: TestRecord1,
}
#[fce]
#[link(wasm_import_module = "some_module")]
extern "C" {
fn foo(mut test_record: TestRecord2) -> TestRecord2;
}
```
{% endtab %}
{% endtabs %}