From 0c270c551d580d8a55a106b5a925569dcb95f051 Mon Sep 17 00:00:00 2001 From: boneyard93501 Date: Fri, 11 Jun 2021 07:21:09 +0000 Subject: [PATCH] GitBook: [main] 53 pages modified --- .../marine/marine-rs-sdk.md | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/knowledge_knowledge/knowledge_aquamarine/marine/marine-rs-sdk.md b/knowledge_knowledge/knowledge_aquamarine/marine/marine-rs-sdk.md index efd0440..bf3746c 100644 --- a/knowledge_knowledge/knowledge_aquamarine/marine/marine-rs-sdk.md +++ b/knowledge_knowledge/knowledge_aquamarine/marine/marine-rs-sdk.md @@ -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`. * 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 #[marine] pub struct TestRecord0 { @@ -127,6 +129,37 @@ pub struct TestRecord2 { #[marine] 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, + 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 %}