Example 2

Rust adjustments for Example "Generate Mnemonic".

What adjustments do I need to make in Rust?

In summary, here are the steps you need to take to create the API function.


There is no need to add any crates. It's the same as in Example 1.

api.rs - Used Paths

There is no need to add any path. It's the same as in Example 1.

api.rs - Function get_node_info()

pub fn generate_mnemonic() -> String {
    let mnemonic = Client::generate_mnemonic();

Checks using cargo build

All checks should work without any issue. Please also refer to the corresponding video (2023-09-03: ToDo).

New: Checks using cargo build

In the next subchapters, we will test individually for each example whether our library can be cross-compiled to the target platforms Android, macOS, and iOS.

This way, we can independently test the correctness of the dependencies in Cargo.toml, and the paths and the syntax of our Rust Code in api.rs, regardless of the Flutter build process.

πŸ‘‰ Β  How to manually cross-compile to a target of your choice

To examine the various targets, you should navigate from playground_app root directory to the rust directory:

cd rust

Then, within the rust directory, excute the following commands.


If you haven't already, install the cargo-ndk command using:

cargo install cargo-ndk

I only check the ABI arm64-v8a.

cargo ndk -t arm64-v8a build


cargo build --target aarch64-apple-darwin

iOS Simulator or iOS Device

cargo build --target aarch64-apple-ios-sim
cargo build --target aarch64-apple-ios