initializeRust function

Future<void> initializeRust(
  1. AssignRustSignal assignRustSignal, {
  2. String? compiledLibPath,
})

Starts the main function in Rust.

Implementation

Future<void> initializeRust(
  AssignRustSignal assignRustSignal, {
  String? compiledLibPath,
}) async {
  // Override the default library path if provided.
  if (compiledLibPath != null) {
    setCompiledLibPathReal(compiledLibPath);
  }

  // Add the print delegation endpoint.
  assignRustSignal['RinfOut'] = (messageBytes, binary) {
    final rustReport = utf8.decode(binary);
    print(rustReport);
  };

  // Prepare the interface with Rust.
  await prepareInterfaceReal(assignRustSignal);
  startRustLogicReal();
}