From aa575ab9a75c940ad46af6132ca6c323dbc3eb7f Mon Sep 17 00:00:00 2001 From: boneyard93501 Date: Fri, 11 Jun 2021 18:00:45 +0000 Subject: [PATCH] GitBook: [main] one page modified --- .../marine/marine-rs-sdk.md | 29 ++++++++++++++++++- 1 file changed, 28 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 cf0d7ce..6c6fdfa 100644 --- a/knowledge_knowledge/knowledge_aquamarine/marine/marine-rs-sdk.md +++ b/knowledge_knowledge/knowledge_aquamarine/marine/marine-rs-sdk.md @@ -114,7 +114,7 @@ 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 `struct` : +See the example below for wrapping `struct`: {% tabs %} {% tab title="Example 1" %} @@ -169,6 +169,33 @@ pub struct TestRecord2 { extern "C" { fn foo(mut test_record: TestRecord2) -> TestRecord2; } +``` +{% endtab %} + +{% tab title="Example 3" %} +```rust +mod data_crate { + use fluence::marine; + #[marine] + pub struct Data { + pub name: String, + pub data: f64, + } +} + +use data_crate::Data; +use fluence::marine; + +fn main() {} + +#[marine] +fn some_function() -> Data { + Data { + name: "example".into(), + data: 1.0, + } +} + ``` {% endtab %} {% endtabs %}