Structures
The #[marine] macro can also wrap a struct making it possible to use it as a function argument or return type. Note that
- only macro-wrapped structures can be used as function arguments and return types
- all fields of the wrapped structure must be public and of the mtype
- it is possible to have inner records in the macro-wrapped structure and to import wrapped structs from other crates
Structure passing requirements
- wrap a structure with the #[marine]macro
- all structures fields must be of the mtype
- the structure must be pointed to without preceding package import in a function signature, i.e. StructureNamebut notpackage_name::module_name::StructureName
- wrapped structures can be imported from crates
Examples
See the examples below for wrapping struct:
- Example 1
- Example 2
- Example 3
rust
rust
rust
rust
rust
rust