High-level memory-safe binding generator for Flutter/Dart <-> Rust

Overview

flutter_rust_bridge: High-level memory-safe binding generator for Flutter/Dart <-> Rust

Codacy Badge Documentation Rust Package Flutter Package Test Codegen Linters

Logo

Want to combine the best between Flutter, a cross-platform hot-reload rapid-development UI toolkit, and Rust, a language empowering everyone to build reliable and efficient software? Here it comes!

🚀 Advantages

  • Memory-safe: Never need to think about malloc/free.
  • Type support: Unlike low-level binding generator which only provide primitives and pointers, this package provides things like Vec<u8>(Uint8List), Vec<T>(List<T>), any custom struct(class)s, and even recursive structs (e.g. a tree node).
  • Zero-copy: Pass big array of bytes from Rust to Dart without any memory copies.
  • Async programming: Simply call functions directly in main isolate (thread) of Dart/Flutter, and Rust code will not block the Flutter UI.
  • Easy to use: All you need to do is write down your Rust code. The code generator will do everything and expose an API in Dart/Flutter's style.
  • Lightweight: This is not a huge framework that includes everything, so you are free to use your favorite Flutter and Rust libraries. For example, state-management with Flutter library (e.g. MobX) can be elegant and simple (contrary to implementing in Rust); implementing a photo manipulation algorithm in Rust will be fast and safe (countrary to implementing in Flutter).
  • Easy to code-review & convince yourself: This package simply simulates how human beings write down boilerplate code. If you want to convince yourself (or your team) that it is safe, there is not much code for you to look at. The runtime is only hundreds of loc, and the generated code follows simple patterns. No magic at all! (More about safety concerns.)
  • Pure-Dart compatible: Despite the name, this package is 100% compatible with pure Dart. It does not require anything specific to Flutter. See this pure-Dart example.

🧭 Show me the code

What you write down (in Rust):

pub fn my_function(a: MyTreeNode, b: SomeOtherStruct) -> Result<Vec<u8>> {
    ... do my heavy computations ...
}

// you can use structs (even recursive)
pub struct TreeNode { pub value: String, pub children: Vec<MyTreeNode> }

With bindings automatically generated, you can simply use the following API in Flutter/Dart. Nothing more.

Future<Uint8List> myFunction(MyTreeNode a, SomeOtherStruct b);

Remark: Why Future in Flutter: Flutter is single-threaded. If not using future, just like what you do with plain-old Flutter bindings, your UI will be stuck as long as your Rust code is executing. If your Rust code run for a second, your UI will fully freeze for one second.

💡 Quickstart

Install

  • Install dependency cbindgen: cargo install cbindgen (may need latest version, thanks @gmorenz)
  • Install dependency ffigen: dart pub global activate ffigen, and install LLVM.
  • Install this code generator binary by cargo install flutter_rust_bridge_codegen.
  • Add flutter_rust_bridge = "1.0" (where 1.0 should be the latest version) to Rust's Cargo.toml.
  • Add flutter_rust_bridge: ^1.0 (same as above, should be latest version) to Flutter/Dart's pubspec.yaml under the section of dependencies.

Run

flutter_rust_bridge_codegen --rust-input path/to/your/api.rs --dart-output path/to/file/being/bridge_generated.dart

(If you have problems, see "Troubleshooting" section.) (For more options, use --help; To see what types and function signatures can you write in Rust, have a look at this example.) (For Windows, you may need \\ instead of / for paths.)

Enjoy

Use the class in the generated .dart file, as if it is a normal Flutter/Dart class! (The abstract class at the top of the generated file.)

Want to see a Flutter tutorial with UI? See the tutorial section below. Want pure-Dart example? Here is another tutorial.

Remark: If you are interested, why abstractclass can be used - it is because of the factory language feature.

📪 Safety

This library has CI that runs Valgrind automatically on the setup that a Dart program calls a Rust program using this package, so memory problems should be found by Valgrind. (Notice that, even when running a simple hello-world Dart program, Valgrind will report hundreds of errors. See this Dart lang issue for more details. Therefore, I both look at "definitely lost" in Valgrind, and manually search things related to this library - if all reported errors are unrelated to this library then we are safe.)

In addition, Flutter integration tests are also done in CI. This ensures a real Flutter application using this library does not suffer from problems.

Most of the code are written in safe Rust. The unsafe code mainly comes from support::box_from_leak_ptr and support::vec_from_leak_ptr. They are used for pointers and arrays, and I follow the high-upvoted answers and official doc when writing down that few lines of code.

I use this library heavily in my own Flutter project (yplusplus, or why++). That app is in production and it works quite well. If I observe any problems, I will fix it in this library.

The CI also runs the run_codegen workflow, which ensure that the code generator can compile and generate desired results. Lastly, the CI also runs formatters and linters (fmt, clippy, dart analyze, dart format), and linters can also catch some common problems.

📚 Tutorial: A Flutter+Rust app

Remark: The flutter_*_test sections of the CI workflow can also be useful, if you want details of each command.

Get example code

Please install Flutter, install Rust, and have some familiarity with them. Then run git clone https://github.com/fzyzcjy/flutter_rust_bridge, and my example is in frb_example/with_flutter.

(Optional) Run code generator

I have generated the source code already (in quickstart), so this step is optional. Even if you do it, you should not see anything changed.

Install it: cargo install flutter_rust_bridge_codegen.

Run it:

flutter_rust_bridge_codegen --rust-input frb_example/with_flutter/rust/src/api.rs --dart-output frb_example/with_flutter/lib/bridge_generated.dart --c-output frb_example/with_flutter/ios/Runner/bridge_generated.h

Remark: If you have problems, see "Troubleshooting" section. For Windows, you may need \\ instead of / for paths.

Run "Flutter+Rust" app

With this app, you will see a Mandelbrot set plotted in Flutter UI and generated by Rust algorithm.

If Android

Run cargo ndk -o ../android/app/src/main/jniLibs build. Then run the Flutter app normally as is taught in official tutorial. For example, flutter run.

Remark: Since my quickstart app is so baremetal, I do not integrate the Rust building process into Flutter building process. But you can look at this tutorial to easily do that.

If iOS

Modify Cargo.toml to change cdylib to staticlib. (Again, this is baremetal example so it is done manually. For your project, you can automate it.)

Run cargo lipo && cp target/universal/debug/libflutter_rust_bridge_example.a ../ios/Runner to build Rust and copy the static library. Then run the Flutter app normally as is taught in official tutorial. For example, flutter run. (Similarly, this tutorial can automate the process.)

If desktop (Windows/Linux/MacOS)

Run it directly using flutter run assuming Flutter desktop support has been configured.

Flutter can run on Windows/Linux/MacOS without any problem, and this lib does nothing but generates some code like a human being. Therefore, this package should work well as long as you set up the Flutter desktop app's ffi functionality successfully.

The example in with_flutter demonstrates how to integrate Cargo with CMake on Linux and Windows, so it can be. More details can be seen in the issue.

(Optional) See more types that this library can generate

Have a look at the function arguments and return types in this file: api.rs. With this library, we have a generated API that resides at generated_api.dart (of course, that is auto generated, and you can use it in other Dart code).

(Optional) Remarks

The mod

If you are adding this lib to your own existing code, please put mod generated_wire; (where generated_wire is the name of the wire file that you choose) into your lib.rs or main.rs. Only by doing this, Rust can understand that this generated file is a part of your project.

Version

Dart SDK >=2.14.0 is needed not by this library, but by the latest version of the ffigen tool. Therefore, write sdk: ">=2.14.0 <3.0.0" in the environment section of pubspec.yaml. If you do not want that, consider installing a older version of the ffigen tool.

📚 Tutorial: Pure Dart

Remark: The valgrind_test section of the CI workflow can also be useful, if you want details of each command and want to see Valgrind configuration.

Unlike the previous tutorial, this one integrates Rust with pure Dart instead of Flutter.

Get example code

Please install Dart, install Rust, and have some familiarity with them. Then run git clone https://github.com/fzyzcjy/flutter_rust_bridge, and my example is in frb_example/pure_dart.

(Optional) Run code generator

Remark: I have generated the source code already (in quickstart), so this step is optional. Even if you do it, you should not see anything changed.

Install it: cargo install flutter_rust_bridge_codegen.

Run it: flutter_rust_bridge_codegen --rust-input frb_example/pure_dart/rust/src/api.rs --dart-output frb_example/pure_dart/dart/lib/bridge_generated.dart (See CI workflow as a reference.) (For Windows, you may need \\ instead of / for paths.)

Run "Dart+Rust" app

You may run frb_example/pure_dart/dart/lib/main.dart as a normal Dart program, except that you should provide the dynamic linked library of the Rust code (for simplicity, here I only demonstrate the approach for dynamic linked library, but you can for sure use other methods). The detailed steps are as follows.

Run cargo build in frb_example/pure_dart/rust to build the Rust code into a .so file. Then run dart frb_example/pure_dart/dart/lib/main.dart frb_example/pure_dart/rust/target/debug/libflutter_rust_bridge_example.so to run the Dart program with Rust .so file. (If you have problems, see "Troubleshooting" section.) (If on MacOS, Rust may indeed generate .dylib, so change the last command to use ...dylib instead of ...so,)

P.S. You will only see some tests passing - no fancy UI or functionality in this example.

Command line arguments

Simply add --help to see full documentation.

flutter_rust_bridge_codegen

USAGE:
    flutter_rust_bridge_codegen [FLAGS] [OPTIONS] --dart-output <dart-output> --rust-input <rust-input>

FLAGS:
        --skip-add-mod-to-lib    Skip automatically adding `mod bridge_generated;` to `lib.rs`
    -h, --help                   Prints help information
    -V, --version                Prints version information

OPTIONS:
    -r, --rust-input <rust-input>                              Path of input Rust code
    -d, --dart-output <dart-output>                            Path of output generated Dart code
    -c, --c-output <c-output>                                  Path of output generated C header
        --rust-crate-dir <rust-crate-dir>                      Crate directory for your Rust project
        --rust-output <rust-output>                            Path of output generated Rust code
        --class-name <class-name>                              Generated class name
        --dart-format-line-length <dart-format-line-length>    Line length for dart formatting
        --llvm-path <llvm-path>                                Path to the installed LLVM

What this library is & isn't

This library is nothing but a code generator that helps your Flutter/Dart functions call Rust functions. Therefore, you may refer to external materials to learn Flutter, learn Rust, learn Flutter FFI (Dart FFI) and so on. With material on the Internet, you will know how to create a mobile application using Flutter, and how that app can call Rust functions via Dart FFI (in the C ABI). Then this package comes in, and ease you from the burden to write down tons of boilerplate code ;)

Troubleshooting

Have problems when using Linux?

Try to run code generator with working directory at /. This seems to be a problem with Rust's builtin Command. See #108 for more details.

Error running cargo ndk: ld: error: unable to find library -lgcc

Downgrade Android NDK to version 22. This is an ongoing issue with cargo-ndk, a library unrelated to flutter_rust_bridge but solely used to build the examples, when using Android NDK version 23. (See #149)

Other problems?

Don't hesitate to open an issue! I usually reply within minutes or hours (except when sleeping, of course).

Advanced

Customize handler's behavior

By default, the DefaultHandler is used. You can implement your own Handler doing whatever you want. In order to do this, create a variable named FLUTTER_RUST_BRIDGE_HANDLER in the Rust input file (probably using lazy_static). You may not need to create a brand new struct implementing Handler, but instead, use the SimpleHandler and customize its generic arguments such as its Executor.

Setup/init FFI call

If you want that feature, have a look at FlutterRustBridgeSetupMixin in the Dart side.

Appendix: Set up Flutter/Dart+Rust support

I suggest that you can start with the Flutter example first, and modify it to satisfy your needs. It can serve as a template for new projects. It is run against CI so we are sure it works.

Indeed, this library is nothing but a code generator that helps your Flutter/Dart functions call Rust functions. Therefore, "how to create a Flutter app that can run Rust code" is actually out of the scope of this library, and there are already several tutorials on the Internet.

However, I can sketch the outline of what to do if you want to set up a new Flutter+Rust project as follows.

Step 1: Create a new Flutter project (or use an existing one). The Dart SDK should be >=2.14.0 if you want to use the latest ffigen tool.

Step 2: Create a new Rust project, say, at directory rust under the Flutter project.

Step 3: Edit Cargo.toml and add:

[lib]
name = "flutter_rust_bridge_example" # whatever you like
crate-type = ["cdylib"] # <-- notice this type. `cdylib` for android, and `staticlib` for iOS. I write down a script to change it before build.

Step 4: Follow the standard steps of "how iOS uses static libraries". For example, in XCode, edit Strip Style in Build Settings to Debugging Symbols. Also, add your libyour_generate_file.a to Link Binary With Libraries in Build Phases. Add binding.h to Copy Bundle Resources. Add #import "binding.h" to Runner-Bridging-Header. Last but not least, add a never-to-be-executed dummy function in Swift that calls any of the generated C bindings. This lib has already generated a dummy method for you, so you simply need to add print("dummy_value=\(dummy_method_to_enforce_bundling())"); to swift file's override func application(...) {}, and this will prevent symbol stripping - especially in the release build for iOS (i.e. when building ipa file or releasing to App Store). Notice that, we have to use that dummy_method_to_enforce_bundling(), otherwise the symbols will not maintain in the release build, and Flutter will complain it cannot find the symbols.

Lastly, in order to build Rust automatically when you are building Flutter, follow this tutorial.

Appendix: Future work

I plan to support the following features. Of course, if you want to have other features, feel free to make an issue or PR.

  • Support async in Rust (currently only async in Dart). Should be quite easy to implement; I have not done it because my use case currently does not includ that, but feel free to PR.
  • Beautify the generated code, possibly making the cases (camel/snake/...) consistent with the language guide.
  • Make the code generator more robust to invalid inputs.

Appendix: Contributing

Please look at contributing guide.

Contributors

All Contributors

Thanks goes to these wonderful people (emoji key):


fzyzcjy

💻 📖 💡 🤔 🚧

Viet Dinh

💻 ⚠️ 📖

Marcel

💻

rustui

📖

Michael Bryan

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Comments
  • `StreamSink` does not work (cause: version is not updated), and a few questions about sending data from rust

    `StreamSink` does not work (cause: version is not updated), and a few questions about sending data from rust

    Hi again :) well okay I am trying to figure out what is the best approach to use a stream for events when it is not possible to send rust enums with data. so is the only way to this using a global state with streams for each type and guard it with a mutex? if that is possible. thanks

    bug 
    opened by The-Mr-L 60
  • Serious lack of quality in documentation

    Serious lack of quality in documentation

    Hello,

    I was recently referred to this project by the team at Tokio. It looks very promising, however, the documentation suffers from a serious lack of quality and substance.

    There is no "hello world" example and basic steps to get an example working. The tutorial is beyond brief and contains many broken links.

    We've attempted to run the example projects by cloning the repo and ensuring all the dependencies are installed as per: https://fzyzcjy.github.io/flutter_rust_bridge/quickstart.html#-show-me-the-code

    When executing the project using the command: flutter_rust_bridge_codegen --rust-input frb_example/pure_dart/rust/src/api.rs --dart-output frb_example/pure_dart/lib/bridge_generated.dart --c-output frb_example/pure_dart/ios/Runner/bridge_generated.h

    the process panics with:

    [SEVERE] : Couldn't find dynamic library in default locations. [SEVERE] : Please supply one or more path/to/llvm in ffigen's config under the key 'llvm-path'.

    Please provide a simple step-by-step guide to setting up a hello world application. Please do not simply write refer to this and refer to that, and then see this over here and download this here and hope it works. This is an incredibly unprofessional way to present your tool and makes it very difficult to take your project seriously as a professional tool.

    enhancement 
    opened by danielcasler 59
  • Impl opaque type

    Impl opaque type

    Implement support Opaque type #775. This PR is a revision of PR #293 (Thanks to @Desdaemon).

    Updated #293 to 1.49. Implemented web opaque type. Fixed Arc persistence. Added finalizers for web and desktop platforms.

    Checklist

    • [x] An issue to be fixed by this PR is listed above.
    • [x] New tests are added to ensure new features are working. End-to-end tests are usually in the ./frb_example/pure_dart example, more specifically, rust/src/api.rs and dart/lib/main.dart.
    • [x] The code generator is run and the code is formatted (e.g. via just refresh_all).
    • [x] If this PR adds/changes features, documentations (in the ./book folder) are updated.
    • [x] CI is passing.
    opened by rogurotus 53
  • Opaque types

    Opaque types

    • Resolves #243
    • Resolves #68

    There are a few kinks to work out before we can stabilize it:

    • [x] Dart API
    • [x] Safety
    • [x] Data structure
    • [ ] Safety documentation

    Other tasks:

    • [x] ~~Copy use statements from API file~~ Require users to declare pub use
    • [x] ~~Find a way to safely convert between pointers of unrelated types~~ Cast to *const c_void

    More other tasks (added by @fzyzcjy):

    • [x] more simple tests (since this can cause very hard-to-debug bugs)
    • [x] more concurrent tests - many bugs may only happen under extreme conditions
    • [x] fix the dangerous bug: https://github.com/fzyzcjy/flutter_rust_bridge/pull/293#issuecomment-1006191364
    • [x] fix another possibly bug https://github.com/fzyzcjy/flutter_rust_bridge/pull/293#issuecomment-1006204527
    • [ ] enhance valgrind checker: currently all invalid memory access are simply ignored, because even a literally hello-world simple dart program will cause tons of invalid memory access. But since this feature is tricky we may need stronger checks.
    • [ ] add changelog
    • [ ] publish new version

    Dart API

    An opaque pointer to e.g. [u8; 2000] would look like this:

    class U82000 extends Opaque {
      U8200._(int ptr, int drop) : super(Pointer.fromAddress(ptr), Pointer.fromAddress(drop));
    
      void dispose(); // implemented by super, safe to call many times
      bool isStale(); // true if dispose has been called
    }
    

    I don't know if there's a lint that enforces calling dispose, but it would be really helpful for this situation. Otherwise, I think this is an acceptable API to use. ~~Then in the future when weak references are implemented, calls to dispose will become no-op and be deprecated.~~ It is most likely that dispose will continue to be necessary in the foreseeable future.

    Safety

    Resolved: Opaque may not obtain a mutable reference. Here's the original text:

    The Rust side however has the issue of whether we should allow Rust functions to obtain a mutable reference to T:
    impl<T> Opaque<T> {
      ..
      pub unsafe fn as_mut(&mut self) -> Option<&mut T>;
    }
    

    then in a function:

    pub fn handle_opaque(mut arr: Opaque<[u8; 2000]>) -> Result<()> {
      unsafe {
        if let Some(arr) = arr.as_mut() {
          std::mem::drop_in_place(arr); // instant UB
        }
      }
      Ok(())
    }
    

    In line with other Rust API, since we do not have ownership of T we can't really hand out mutable references, but not having this functionality also precludes a lot of potential usage out of opaque pointers. I'm not quite sure how to proceed here.

    opened by Desdaemon 50
  • Web support

    Web support

    Closes #315. Continues from #386.

    Additions:

    • --wasm flag to emit WASM-specific files
      • Requires --dart-decl-output
    • --inline-rust to inline platform modules into a single file
    • WASM shims for allo_isolate (merge upstream?)

    Changes:

    • Migrate to clap v3

    Internal changes:

    • Functions that used to pluck values from Opts now receive a reference to Opts

    Checklist

    • [x] New tests are added to ensure new features are working (probably by modifying the frb_example/pure_dart example).
    • [x] All existing and new tests are passing.
    • [x] If this PR adds/changes features, documentations (in book folder) are modified as well.
    opened by Desdaemon 49
  • [Bug] Compiles with 1.51, does not compile with 1.53.

    [Bug] Compiles with 1.51, does not compile with 1.53.

    Describe the bug

    My project is at https://github.com/gjf2a/groundline.

    It compiles and runs perfectly well with frb 1.51.0.

    It does not compile with frb 1.53.0. I was careful to run flutter pub upgrade and then regenerate the bridge code after upgrading. If I switch back to 1.51.0, it compiles and runs with no trouble whatsoever.

    Here is the error message:

    Launching lib\main.dart on KFAUWI in debug mode...
    Running Gradle task 'assembleDebug'...
    lib/bridge_generated.dart:363:7: Error: The non-abstract class 'NativeWire' is missing implementations for these members:
     - FlutterRustBridgeWireBase.drop_dart_object
     - FlutterRustBridgeWireBase.get_dart_object
     - FlutterRustBridgeWireBase.new_dart_opaque
    Try to either
     - provide an implementation,
     - inherit an implementation from a superclass or mixin,
     - mark the class as abstract, or
     - provide a 'noSuchMethod' implementation.
    
    class NativeWire implements FlutterRustBridgeWireBase {
          ^^^^^^^^^^
    ../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/flutter_rust_bridge-1.53.0/lib/src/ffi/stub.dart:31:8: Context: 'FlutterRustBridgeWireBase.drop_dart_object' is defined here.
      void drop_dart_object(int ptr) {
           ^^^^^^^^^^^^^^^^
    ../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/flutter_rust_bridge-1.53.0/lib/src/ffi/stub.dart:26:10: Context: 'FlutterRustBridgeWireBase.get_dart_object' is defined here.
      Object get_dart_object(int ptr) {
             ^^^^^^^^^^^^^^^
    ../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/flutter_rust_bridge-1.53.0/lib/src/ffi/stub.dart:36:7: Context: 'FlutterRustBridgeWireBase.new_dart_opaque' is defined here.
      int new_dart_opaque(Object obj) {
          ^^^^^^^^^^^^^^^
    
    
    FAILURE: Build failed with an exception.
    
    * Where:
    Script 'C:\Users\ferrer\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159
    
    * What went wrong:
    Execution failed for task ':app:compileFlutterBuildDebug'.
    > Process 'command 'C:\Users\ferrer\flutter\bin\flutter.bat'' finished with non-zero exit value 1
    
    * Try:
    > Run with --stacktrace option to get the stack trace.
    > Run with --info or --debug option to get more log output.
    > Run with --scan to get full insights.
    
    * Get more help at https://help.gradle.org
    
    BUILD FAILED in 18s
    Exception: Gradle task assembleDebug failed with exit code 1
    

    Codegen logs with RUST_LOG=debug environment variable

    PS C:\Users\ferrer\AndroidStudioProjects\groundline\native> $env:RUST_LOG='debug'
    PS C:\Users\ferrer\AndroidStudioProjects\groundline\native> flutter_rust_bridge_codegen --rust-input src\api.rs --dart-output ..\lib\bridge_generated.dart --dart-decl-output ..\lib\bridge_definitions.dart
    [2022-12-07T21:58:25Z DEBUG flutter_rust_bridge_codegen] configs=[Opts { rust_input_path: "C:\\Users\\ferrer\\AndroidStudioProjects\\groundline\\native\\src\\api.rs", dart_output_path: "C:\\Users\\ferrer\\AndroidStudioProjects\\groundline\\native\\..\\lib\\bridge_generated.dart", dart_decl_output_path: Some("C:\\Users\\ferrer\\AndroidStudioProjects\\groundline\\native\\..\\lib\\bridge_definitions.dart"), c_output_path: ["C:\\Users\\ferrer\\AppData\\Local\\Temp\\.tmpG9E0FZ.h"], rust_crate_dir: "C:\\Users\\ferrer\\AndroidStudioProjects\\groundline\\native", rust_output_path: 
    "C:\\Users\\ferrer\\AndroidStudioProjects\\groundline\\native\\src\\bridge_generated.rs", class_name: "Native", dart_format_line_length: 80, skip_add_mod_to_lib: false, llvm_path: ["/opt/homebrew/opt/llvm", "/usr/local/opt/llvm", "/usr/lib/llvm-9", "/usr/lib/llvm-10", "/usr/lib/llvm-11", "/usr/lib/llvm-12", "/usr/lib/llvm-13", "/usr/lib/llvm-14", "/usr/lib/", "/usr/lib64/", "C:/Program Files/llvm", "C:/msys64/mingw64"], llvm_compiler_opts: "", manifest_path: "C:\\Users\\ferrer\\AndroidStudioProjects\\groundline\\native\\Cargo.toml", dart_root: Some("C:\\Users\\ferrer\\AndroidStudioProjects\\groundline\\native\\.."), build_runner: true, block_index: BlockIndex(0), skip_deps_check: false, wasm_enabled: false, inline_rust: false }]
    [2022-12-07T21:58:26Z DEBUG lib_flutter_rust_bridge_codegen::source_graph] Trying to parse "\\\\?\\C:\\Users\\ferrer\\AndroidStudioProjects\\groundline\\native\\src\\api.rs"
    [2022-12-07T21:58:26Z DEBUG lib_flutter_rust_bridge_codegen::source_graph] Trying to parse "\\\\?\\C:\\Users\\ferrer\\AndroidStudioProjects\\groundline\\native\\src\\bridge_generated.rs"
    [2022-12-07T21:58:26Z WARN  lib_flutter_rust_bridge_codegen::source_graph] Skipping unresolvable module io (tried \\?\C:\Users\ferrer\AndroidStudioProjects\groundline\native\src\io.rs, \\?\C:\Users\ferrer\AndroidStudioProjects\groundline\native\src\io\mod.rs, \\?\C:\Users\ferrer\AndroidStudioProjects\groundline\native\src\bridge_generated\io.rs, \\?\C:\Users\ferrer\AndroidStudioProjects\groundline\native\src\bridge_generated\io\mod.rs, )
    [2022-12-07T21:58:26Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(kmeans_ready)
    [2022-12-07T21:58:26Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(training_time)
    [2022-12-07T21:58:26Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(intensity_rgba)
    [2022-12-07T21:58:26Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(yuv_rgba)
    [2022-12-07T21:58:26Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(color_count)
    [2022-12-07T21:58:26Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(groundline_sample_overlay)
    [2022-12-07T21:58:26Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(start_kmeans_training)
    [2022-12-07T21:58:26Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(color_clusterer)
    [2022-12-07T21:58:26Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(groundline_k_means)
    [2022-12-07T21:58:26Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(get_correlation_flow)
    [2022-12-07T21:58:26Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(reset_position_estimate)
    [2022-12-07T21:58:26Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(process_sensor_data)
    [2022-12-07T21:58:26Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(parse_sensor_data)
    [2022-12-07T21:58:26Z DEBUG lib_flutter_rust_bridge_codegen::tools] Guessing toolchain the runner is run into
    [2022-12-07T21:58:26Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute command: bin=powershell args="-noprofile -command & \"flutter\" \"--version\"" current_dir=None cmd="powershell" "-noprofile" "-command" "& \"flutter\" \"--version\""
    Flutter 3.3.9 • channel stable • https://github.com/flutter/flutter.git
    Framework • revision b8f7f1f986 (2 weeks ago) • 2022-11-23 06:43:51 +0900
    Engine • revision 8f2221fbef
    Tools • Dart 2.18.5 • DevTools 2.15.0
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::commands] command="powershell" "-noprofile" "-command" "& \"flutter\" \"--version\"" stdout= stderr=
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::tools] Checking presence of ffi in dependencies at C:\Users\ferrer\AndroidStudioProjects\groundline\native\..
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::tools] Checking presence of ffi in dependencies at C:\Users\ferrer\AndroidStudioProjects\groundline\native\..
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::tools] Checking presence of ffigen in dev_dependencies at C:\Users\ferrer\AndroidStudioProjects\groundline\native\..
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::tools] Checking presence of ffigen in dev_dependencies at C:\Users\ferrer\AndroidStudioProjects\groundline\native\..
    [2022-12-07T21:58:28Z INFO  lib_flutter_rust_bridge_codegen] Picked config: Opts { rust_input_path: "C:\\Users\\ferrer\\AndroidStudioProjects\\groundline\\native\\src\\api.rs", dart_output_path: "C:\\Users\\ferrer\\AndroidStudioProjects\\groundline\\native\\..\\lib\\bridge_generated.dart", dart_decl_output_path: Some("C:\\Users\\ferrer\\AndroidStudioProjects\\groundline\\native\\..\\lib\\bridge_definitions.dart"), c_output_path: ["C:\\Users\\ferrer\\AppData\\Local\\Temp\\.tmpG9E0FZ.h"], rust_crate_dir: "C:\\Users\\ferrer\\AndroidStudioProjects\\groundline\\native", rust_output_path: "C:\\Users\\ferrer\\AndroidStudioProjects\\groundline\\native\\src\\bridge_generated.rs", class_name: "Native", dart_format_line_length: 80, skip_add_mod_to_lib: false, llvm_path: ["/opt/homebrew/opt/llvm", "/usr/local/opt/llvm", "/usr/lib/llvm-9", "/usr/lib/llvm-10", "/usr/lib/llvm-11", "/usr/lib/llvm-12", "/usr/lib/llvm-13", "/usr/lib/llvm-14", "/usr/lib/", "/usr/lib64/", "C:/Program Files/llvm", "C:/msys64/mingw64"], llvm_compiler_opts: "", manifest_path: "C:\\Users\\ferrer\\AndroidStudioProjects\\groundline\\native\\Cargo.toml", dart_root: Some("C:\\Users\\ferrer\\AndroidStudioProjects\\groundline\\native\\.."), build_runner: true, block_index: BlockIndex(0), skip_deps_check: false, wasm_enabled: false, inline_rust: false }
    [2022-12-07T21:58:28Z INFO  lib_flutter_rust_bridge_codegen] Phase: Parse source code to AST, then to IR
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::source_graph] Trying to parse "\\\\?\\C:\\Users\\ferrer\\AndroidStudioProjects\\groundline\\native\\src\\api.rs"
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::source_graph] Trying to parse "\\\\?\\C:\\Users\\ferrer\\AndroidStudioProjects\\groundline\\native\\src\\bridge_generated.rs"
    [2022-12-07T21:58:28Z WARN  lib_flutter_rust_bridge_codegen::source_graph] Skipping unresolvable module io (tried \\?\C:\Users\ferrer\AndroidStudioProjects\groundline\native\src\io.rs, \\?\C:\Users\ferrer\AndroidStudioProjects\groundline\native\src\io\mod.rs, \\?\C:\Users\ferrer\AndroidStudioProjects\groundline\native\src\bridge_generated\io.rs, \\?\C:\Users\ferrer\AndroidStudioProjects\groundline\native\src\bridge_generated\io\mod.rs, )
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(kmeans_ready)
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(training_time)
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(intensity_rgba)
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(yuv_rgba)
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(color_count)
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(groundline_sample_overlay)
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(start_kmeans_training)
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(color_clusterer)
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(groundline_k_means)
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(get_correlation_flow)
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(reset_position_estimate)
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(process_sensor_data)
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(parse_sensor_data)
    [2022-12-07T21:58:28Z INFO  lib_flutter_rust_bridge_codegen] Phase: Transform IR
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::transformer] transform_func_input_add_boxed wrap Boxed to field=IrField { ty: StructRef(IrTypeStructRef { name: "ImageData", freezed: false }), name: IrIdent { raw: "img" }, is_final: true, comments: [] }
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::transformer] transform_func_input_add_boxed wrap Boxed to field=IrField { ty: StructRef(IrTypeStructRef { name: "ImageData", freezed: false }), name: IrIdent { raw: "img" }, is_final: true, comments: [] }
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::transformer] transform_func_input_add_boxed wrap Boxed to field=IrField { ty: StructRef(IrTypeStructRef { name: "ImageData", freezed: false }), name: IrIdent { raw: "img" }, is_final: true, comments: [] }
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::transformer] transform_func_input_add_boxed wrap Boxed to field=IrField { ty: StructRef(IrTypeStructRef { name: "ImageData", freezed: false }), name: IrIdent { raw: "img" }, is_final: true, comments: [] }
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::transformer] transform_func_input_add_boxed wrap Boxed to field=IrField { ty: StructRef(IrTypeStructRef { name: "ImageData", freezed: false }), name: IrIdent { raw: "img" }, is_final: true, comments: [] }
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::transformer] transform_func_input_add_boxed wrap Boxed to field=IrField { ty: StructRef(IrTypeStructRef { name: "ImageData", freezed: false }), name: IrIdent { raw: "img" }, is_final: true, comments: [] }
    [2022-12-07T21:58:28Z INFO  lib_flutter_rust_bridge_codegen] Phase: Generate Rust code
    [2022-12-07T21:58:28Z INFO  lib_flutter_rust_bridge_codegen] Phase: Generate Dart code
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::generator::dart] distinct_input_types=[Delegate(String), Boxed(IrTypeBoxed { exist_in_real_api: false, inner: StructRef(IrTypeStructRef { name: "ImageData", freezed: false }) }), Primitive(I64), StructRef(IrTypeStructRef { name: 
    "ImageData", freezed: false }), Primitive(U8), PrimitiveList(IrTypePrimitiveList { primitive: U8 })]
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::generator::dart] distinct_output_types=[Delegate(String), Delegate(ZeroCopyBufferVecPrimitive(U8)), Primitive(Bool), StructRef(IrTypeStructRef { name: "CorrelationFlow", freezed: false }), Primitive(I16), Primitive(I64), StructRef(IrTypeStructRef { name: "SensorData", freezed: false }), Primitive(U8), PrimitiveList(IrTypePrimitiveList { primitive: U8 }), Primitive(Unit)] 
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute format_rust path=["C:\\Users\\ferrer\\AndroidStudioProjects\\groundline\\native\\src\\bridge_generated.rs"]
    [2022-12-07T21:58:28Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute command: bin=rustfmt args="C:\\Users\\ferrer\\AndroidStudioProjects\\groundline\\native\\src\\bridge_generated.rs" current_dir=None cmd="rustfmt" "C:\\Users\\ferrer\\AndroidStudioProjects\\groundline\\native\\src\\bridge_generated.rs"
    [2022-12-07T21:58:29Z DEBUG lib_flutter_rust_bridge_codegen::commands] command="rustfmt" "C:\\Users\\ferrer\\AndroidStudioProjects\\groundline\\native\\src\\bridge_generated.rs" stdout= stderr=
    [2022-12-07T21:58:29Z INFO  lib_flutter_rust_bridge_codegen] Phase: Generating Dart bindings for Rust
    [2022-12-07T21:58:29Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute cbindgen rust_crate_dir=C:\Users\ferrer\AndroidStudioProjects\groundline\native c_output_path=C:\Users\ferrer\AppData\Local\Temp\.tmpvY1CSd.h
    [2022-12-07T21:58:29Z DEBUG lib_flutter_rust_bridge_codegen::commands] cbindgen config: Config {
            header: None,
            includes: [],
            sys_includes: [
                "stdbool.h",
                "stdint.h",
                "stdlib.h",
            ],
            after_includes: None,
            trailer: None,
            include_guard: None,
            pragma_once: false,
            no_includes: true,
            autogen_warning: None,
            include_version: false,
            namespace: None,
            namespaces: None,
            using_namespaces: None,
            braces: SameLine,
            line_length: 100,
            tab_width: 2,
            line_endings: LF,
            language: C,
            cpp_compat: false,
            style: Both,
            sort_by: None,
            usize_is_size_t: false,
            parse: ParseConfig {
                parse_deps: false,
                include: None,
                exclude: [],
                expand: ParseExpandConfig {
                    crates: [],
                    all_features: false,
                    default_features: true,
                    features: None,
                    profile: Debug,
                },
                clean: false,
                extra_bindings: [],
            },
            export: ExportConfig {
                include: [
                    "\"wire_CorrelationFlow\"",
                    "\"wire_ImageData\"",
                    "\"wire_SensorData\"",
                ],
                exclude: [],
                rename: {},
                pre_body: {},
                body: {},
                prefix: None,
                item_types: [],
                renaming_overrides_prefixing: false,
                mangle: MangleConfig {
                    rename_types: None,
                    remove_underscores: false,
                },
            },
            macro_expansion: MacroExpansionConfig {
                bitflags: false,
            },
            layout: LayoutConfig {
                packed: None,
                aligned_n: None,
            },
            function: FunctionConfig {
                prefix: None,
                postfix: None,
                must_use: None,
                args: Auto,
                rename_args: None,
                swift_name_macro: None,
                sort_by: None,
                no_return: None,
            },
            structure: StructConfig {
                rename_fields: None,
                derive_constructor: false,
                derive_eq: false,
                derive_neq: false,
                derive_lt: false,
                derive_lte: false,
                derive_gt: false,
                derive_gte: false,
                derive_ostream: false,
                associated_constants_in_body: false,
                must_use: None,
            },
            enumeration: EnumConfig {
                rename_variants: None,
                rename_variant_name_fields: SnakeCase,
                add_sentinel: false,
                prefix_with_name: false,
                derive_helper_methods: false,
                derive_const_casts: false,
                derive_mut_casts: false,
                cast_assert_name: None,
                must_use: None,
                derive_tagged_enum_destructor: false,
                derive_tagged_enum_copy_constructor: false,
                derive_tagged_enum_copy_assignment: false,
                derive_ostream: false,
                enum_class: true,
                private_default_tagged_enum_constructor: false,
            },
            constant: ConstantConfig {
                allow_static_const: true,
                allow_constexpr: true,
                sort_by: None,
            },
            defines: {},
            documentation: true,
            documentation_style: Auto,
            documentation_length: Full,
            pointer: PtrConfig {
                non_null_attribute: None,
            },
            only_target_dependencies: false,
            cython: CythonConfig {
                header: None,
                cimports: {},
            },
        }
    [2022-12-07T21:58:29Z DEBUG cbindgen::bindgen::parser] Parsing crate native
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::RgbTriple - opaque (Tuples are not supported types.).
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::ImageData - opaque (Struct is not marked #[repr(C)] or #[repr(transparent)].).
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::SensorData - opaque (Struct is not marked #[repr(C)] or #[repr(transparent)].).
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::parser] Skip native::UPPER_SAMPLE_HEIGHT - (not `pub`).
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::parser] Skip native::UPPER_SAMPLE_WIDTH - (not `pub`).
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::parser] Skip native::LOWER_SAMPLE_WIDTH - (not `pub`).
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::parser] Skip native::LOWER_SAMPLE_HEIGHT - (not `pub`).
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::Rect - opaque (Struct is not marked #[repr(C)] or #[repr(transparent)].).    
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::GroundlineOverlay - opaque (Struct is not marked #[repr(C)] or #[repr(transparent)].).
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::parser] Skip native::NUM_COLOR_CLUSTERS - (not `pub`).
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::CorrelationFlow - opaque (Struct is not marked #[repr(C)] or #[repr(transparent)].).
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::DartPort.
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::DartPostCObjectFnType.
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::store_dart_post_cobject.
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::WireSyncReturnStruct.
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::wire_kmeans_ready.
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::wire_training_time.
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::wire_intensity_rgba.
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::wire_yuv_rgba.
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::wire_color_count.
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::wire_groundline_sample_overlay.
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::wire_start_kmeans_training.
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::wire_color_clusterer.
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::wire_groundline_k_means.
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::wire_get_correlation_flow.
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::wire_reset_position_estimate.
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::wire_process_sensor_data.
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::wire_parse_sensor_data.
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::new_box_autoadd_image_data_0.
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::new_uint_8_list_0.
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::wire_ImageData.
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::wire_uint_8_list.
    [2022-12-07T21:58:29Z INFO  cbindgen::bindgen::parser] Take native::free_WireSyncReturnStruct.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-12-07T21:58:29Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute ffigen c_path=C:\Users\ferrer\AppData\Local\Temp\.tmpvY1CSd.h dart_path=C:\Users\ferrer\AppData\Local\Temp\.tmp1fnksy llvm_path=["/opt/homebrew/opt/llvm", "/usr/local/opt/llvm", "/usr/lib/llvm-9", "/usr/lib/llvm-10", "/usr/lib/llvm-11", "/usr/lib/llvm-12", "/usr/lib/llvm-13", "/usr/lib/llvm-14", "/usr/lib/", "/usr/lib64/", "C:/Program Files/llvm", "C:/msys64/mingw64"]
    [2022-12-07T21:58:29Z DEBUG lib_flutter_rust_bridge_codegen::commands] ffigen config:
                output: 'C:\Users\ferrer\AppData\Local\Temp\.tmp1fnksy'
                name: 'NativeWire'
                description: 'generated by flutter_rust_bridge'
                headers:
                  entry-points:
                    - 'C:\Users\ferrer\AppData\Local\Temp\.tmpvY1CSd.h'
                  include-directives:
                    - 'C:\Users\ferrer\AppData\Local\Temp\.tmpvY1CSd.h'
                comments: false
                preamble: |
                  // ignore_for_file: camel_case_types, non_constant_identifier_names, avoid_positional_boolean_parameters, annotate_overrides, constant_identifier_names
    
                llvm-path:
                   - '/opt/homebrew/opt/llvm'
                   - '/usr/local/opt/llvm'
                   - '/usr/lib/llvm-9'
                   - '/usr/lib/llvm-10'
                   - '/usr/lib/llvm-11'
                   - '/usr/lib/llvm-12'
                   - '/usr/lib/llvm-13'
                   - '/usr/lib/llvm-14'
                   - '/usr/lib/'
                   - '/usr/lib64/'
                   - 'C:/Program Files/llvm'
                   - 'C:/msys64/mingw64'
    
    [2022-12-07T21:58:29Z DEBUG lib_flutter_rust_bridge_codegen::commands] ffigen config_file: NamedTempFile("C:\\Users\\ferrer\\AppData\\Local\\Temp\\.tmp4ruDu5")
    [2022-12-07T21:58:29Z DEBUG lib_flutter_rust_bridge_codegen::tools] Guessing toolchain the runner is run into
    [2022-12-07T21:58:29Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute command: bin=powershell args="-noprofile -command & \"flutter\" \"pub\" \"run\" \"ffigen\" \"--config\" \"C:\\\\Users\\\\ferrer\\\\AppData\\\\Local\\\\Temp\\\\.tmp4ruDu5\"" current_dir=Some("C:\\Users\\ferrer\\AndroidStudioProjects\\groundline\\native\\..") cmd="powershell" "-noprofile" "-command" "& \"flutter\" \"pub\" \"run\" \"ffigen\" \"--config\" \"C:\\\\Users\\\\ferrer\\\\AppData\\\\Local\\\\Temp\\\\.tmp4ruDu5\""
    Running in Directory: 'C:\Users\ferrer\AndroidStudioProjects\groundline'
    Input Headers: [C:\Users\ferrer\AppData\Local\Temp\.tmpvY1CSd.h]
    Finished, Bindings generated in C:\Users\ferrer\AppData\Local\Temp\.tmp1fnksy
    [2022-12-07T21:58:32Z DEBUG lib_flutter_rust_bridge_codegen::commands] command="powershell" "-noprofile" "-command" "& \"flutter\" \"pub\" \"run\" \"ffigen\" \"--config\" \"C:\\\\Users\\\\ferrer\\\\AppData\\\\Local\\\\Temp\\\\.tmp4ruDu5\"" stdout= stderr=
    [2022-12-07T21:58:32Z INFO  lib_flutter_rust_bridge_codegen] Phase: Running build_runner
    [2022-12-07T21:58:32Z INFO  lib_flutter_rust_bridge_codegen] Phase: Formatting Dart code
    [2022-12-07T21:58:32Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute format_dart path=["C:\\Users\\ferrer\\AndroidStudioProjects\\groundline\\native\\..\\lib\\bridge_generated.dart", "C:\\Users\\ferrer\\AndroidStudioProjects\\groundline\\native\\..\\lib\\bridge_definitions.dart"] line_length=80
    [2022-12-07T21:58:32Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute command: bin=powershell args="-noprofile -command & \"dart\" \"format\" \"--line-length\" \"80\" \"C:\\\\Users\\\\ferrer\\\\AndroidStudioProjects\\\\groundline\\\\native\\\\..\\\\lib\\\\bridge_generated.dart\" \"C:\\\\Users\\\\ferrer\\\\AndroidStudioProjects\\\\groundline\\\\native\\\\..\\\\lib\\\\bridge_definitions.dart\"" current_dir=None cmd="powershell" "-noprofile" "-command" "& \"dart\" \"format\" \"--line-length\" \"80\" \"C:\\\\Users\\\\ferrer\\\\AndroidStudioProjects\\\\groundline\\\\native\\\\..\\\\lib\\\\bridge_generated.dart\" \"C:\\\\Users\\\\ferrer\\\\AndroidStudioProjects\\\\groundline\\\\native\\\\..\\\\lib\\\\bridge_definitions.dart\""
    Formatted C:\\Users\\ferrer\\AndroidStudioProjects\\groundline\\native\\..\\lib\\bridge_generated.dart
    Formatted C:\\Users\\ferrer\\AndroidStudioProjects\\groundline\\native\\..\\lib\\bridge_definitions.dart
    Formatted 2 files (2 changed) in 0.32 seconds.
    [2022-12-07T21:58:34Z DEBUG lib_flutter_rust_bridge_codegen::commands] command="powershell" "-noprofile" "-command" "& \"dart\" \"format\" \"--line-length\" \"80\" \"C:\\\\Users\\\\ferrer\\\\AndroidStudioProjects\\\\groundline\\\\native\\\\..\\\\lib\\\\bridge_generated.dart\" \"C:\\\\Users\\\\ferrer\\\\AndroidStudioProjects\\\\groundline\\\\native\\\\..\\\\lib\\\\bridge_definitions.dart\"" stdout= stderr=
    [2022-12-07T21:58:34Z INFO  lib_flutter_rust_bridge_codegen] Success!
    [2022-12-07T21:58:34Z INFO  flutter_rust_bridge_codegen] Now go and use it :)
    PS C:\Users\ferrer\AndroidStudioProjects\groundline\native>
    

    To Reproduce

    Clone https://github.com/gjf2a/groundline

    flutter run

    Expected behavior

    I expected the app to run.

    Generated binding code

    // AUTO GENERATED FILE, DO NOT EDIT.
    // Generated by `flutter_rust_bridge`@ 1.49.0.
    // ignore_for_file: non_constant_identifier_names, unused_element, duplicate_ignore, directives_ordering, curly_braces_in_flow_control_structures, unnecessary_lambdas, slash_for_doc_comments, prefer_const_literals_to_create_immutables, implicit_dynamic_list_literal, duplicate_import, unused_import, prefer_single_quotes, prefer_const_constructors, use_super_parameters, always_use_package_imports, annotate_overrides, invalid_use_of_protected_member, constant_identifier_names
    
    import "bridge_definitions.dart";
    import 'dart:convert';
    import 'dart:async';
    import 'package:flutter_rust_bridge/flutter_rust_bridge.dart';
    
    import 'package:meta/meta.dart';
    import 'dart:convert';
    import 'dart:async';
    import 'package:flutter_rust_bridge/flutter_rust_bridge.dart';
    import 'package:meta/meta.dart';
    import 'dart:ffi' as ffi;
    
    class NativeImpl implements Native {
      final NativePlatform _platform;
      factory NativeImpl(ExternalLibrary dylib) =>
          NativeImpl.raw(NativePlatform(dylib));
    
      /// Only valid on web/WASM platforms.
      factory NativeImpl.wasm(FutureOr<WasmModule> module) =>
          NativeImpl(module as ExternalLibrary);
      NativeImpl.raw(this._platform);
      Future<bool> kmeansReady({dynamic hint}) =>
          _platform.executeNormal(FlutterRustBridgeTask(
            callFfi: (port_) => _platform.inner.wire_kmeans_ready(port_),
            parseSuccessData: _wire2api_bool,
            constMeta: kKmeansReadyConstMeta,
            argValues: [],
            hint: hint,
          ));
    
      FlutterRustBridgeTaskConstMeta get kKmeansReadyConstMeta =>
          const FlutterRustBridgeTaskConstMeta(
            debugName: "kmeans_ready",
            argNames: [],
          );
    
      Future<int> trainingTime({dynamic hint}) =>
          _platform.executeNormal(FlutterRustBridgeTask(
            callFfi: (port_) => _platform.inner.wire_training_time(port_),
            parseSuccessData: _wire2api_i64,
            constMeta: kTrainingTimeConstMeta,
            argValues: [],
            hint: hint,
          ));
    
      FlutterRustBridgeTaskConstMeta get kTrainingTimeConstMeta =>
          const FlutterRustBridgeTaskConstMeta(
            debugName: "training_time",
            argNames: [],
          );
    
      Future<Uint8List> intensityRgba(
              {required Uint8List intensities, dynamic hint}) =>
          _platform.executeNormal(FlutterRustBridgeTask(
            callFfi: (port_) => _platform.inner.wire_intensity_rgba(
                port_, _platform.api2wire_uint_8_list(intensities)),
            parseSuccessData: _wire2api_ZeroCopyBuffer_Uint8List,
            constMeta: kIntensityRgbaConstMeta,
            argValues: [intensities],
            hint: hint,
          ));
    
      FlutterRustBridgeTaskConstMeta get kIntensityRgbaConstMeta =>
          const FlutterRustBridgeTaskConstMeta(
            debugName: "intensity_rgba",
            argNames: ["intensities"],
          );
    
      Future<Uint8List> yuvRgba({required ImageData img, dynamic hint}) =>
          _platform.executeNormal(FlutterRustBridgeTask(
            callFfi: (port_) => _platform.inner.wire_yuv_rgba(
                port_, _platform.api2wire_box_autoadd_image_data(img)),
            parseSuccessData: _wire2api_ZeroCopyBuffer_Uint8List,
            constMeta: kYuvRgbaConstMeta,
            argValues: [img],
            hint: hint,
          ));
    
      FlutterRustBridgeTaskConstMeta get kYuvRgbaConstMeta =>
          const FlutterRustBridgeTaskConstMeta(
            debugName: "yuv_rgba",
            argNames: ["img"],
          );
    
      Future<int> colorCount({required ImageData img, dynamic hint}) =>
          _platform.executeNormal(FlutterRustBridgeTask(
            callFfi: (port_) => _platform.inner.wire_color_count(
                port_, _platform.api2wire_box_autoadd_image_data(img)),
            parseSuccessData: _wire2api_i64,
            constMeta: kColorCountConstMeta,
            argValues: [img],
            hint: hint,
          ));
    
      FlutterRustBridgeTaskConstMeta get kColorCountConstMeta =>
          const FlutterRustBridgeTaskConstMeta(
            debugName: "color_count",
            argNames: ["img"],
          );
    
      Future<Uint8List> groundlineSampleOverlay(
              {required ImageData img, dynamic hint}) =>
          _platform.executeNormal(FlutterRustBridgeTask(
            callFfi: (port_) => _platform.inner.wire_groundline_sample_overlay(
                port_, _platform.api2wire_box_autoadd_image_data(img)),
            parseSuccessData: _wire2api_ZeroCopyBuffer_Uint8List,
            constMeta: kGroundlineSampleOverlayConstMeta,
            argValues: [img],
            hint: hint,
          ));
    
      FlutterRustBridgeTaskConstMeta get kGroundlineSampleOverlayConstMeta =>
          const FlutterRustBridgeTaskConstMeta(
            debugName: "groundline_sample_overlay",
            argNames: ["img"],
          );
    
      Future<void> startKmeansTraining({required ImageData img, dynamic hint}) =>
          _platform.executeNormal(FlutterRustBridgeTask(
            callFfi: (port_) => _platform.inner.wire_start_kmeans_training(
                port_, _platform.api2wire_box_autoadd_image_data(img)),
            parseSuccessData: _wire2api_unit,
            constMeta: kStartKmeansTrainingConstMeta,
            argValues: [img],
            hint: hint,
          ));
    
      FlutterRustBridgeTaskConstMeta get kStartKmeansTrainingConstMeta =>
          const FlutterRustBridgeTaskConstMeta(
            debugName: "start_kmeans_training",
            argNames: ["img"],
          );
    
      Future<Uint8List> colorClusterer({required ImageData img, dynamic hint}) =>
          _platform.executeNormal(FlutterRustBridgeTask(
            callFfi: (port_) => _platform.inner.wire_color_clusterer(
                port_, _platform.api2wire_box_autoadd_image_data(img)),
            parseSuccessData: _wire2api_ZeroCopyBuffer_Uint8List,
            constMeta: kColorClustererConstMeta,
            argValues: [img],
            hint: hint,
          ));
    
      FlutterRustBridgeTaskConstMeta get kColorClustererConstMeta =>
          const FlutterRustBridgeTaskConstMeta(
            debugName: "color_clusterer",
            argNames: ["img"],
          );
    
      Future<Uint8List> groundlineKMeans({required ImageData img, dynamic hint}) =>
          _platform.executeNormal(FlutterRustBridgeTask(
            callFfi: (port_) => _platform.inner.wire_groundline_k_means(
                port_, _platform.api2wire_box_autoadd_image_data(img)),
            parseSuccessData: _wire2api_ZeroCopyBuffer_Uint8List,
            constMeta: kGroundlineKMeansConstMeta,
            argValues: [img],
            hint: hint,
          ));
    
      FlutterRustBridgeTaskConstMeta get kGroundlineKMeansConstMeta =>
          const FlutterRustBridgeTaskConstMeta(
            debugName: "groundline_k_means",
            argNames: ["img"],
          );
    
      Future<CorrelationFlow> getCorrelationFlow(
              {required Uint8List prevYs,
              required Uint8List currentYs,
              required int width,
              required int height,
              dynamic hint}) =>
          _platform.executeNormal(FlutterRustBridgeTask(
            callFfi: (port_) => _platform.inner.wire_get_correlation_flow(
                port_,
                _platform.api2wire_uint_8_list(prevYs),
                _platform.api2wire_uint_8_list(currentYs),
                _platform.api2wire_i64(width),
                _platform.api2wire_i64(height)),
            parseSuccessData: _wire2api_correlation_flow,
            constMeta: kGetCorrelationFlowConstMeta,
            argValues: [prevYs, currentYs, width, height],
            hint: hint,
          ));
    
      FlutterRustBridgeTaskConstMeta get kGetCorrelationFlowConstMeta =>
          const FlutterRustBridgeTaskConstMeta(
            debugName: "get_correlation_flow",
            argNames: ["prevYs", "currentYs", "width", "height"],
          );
    
      Future<void> resetPositionEstimate({dynamic hint}) =>
          _platform.executeNormal(FlutterRustBridgeTask(
            callFfi: (port_) => _platform.inner.wire_reset_position_estimate(port_),
            parseSuccessData: _wire2api_unit,
            constMeta: kResetPositionEstimateConstMeta,
            argValues: [],
            hint: hint,
          ));
    
      FlutterRustBridgeTaskConstMeta get kResetPositionEstimateConstMeta =>
          const FlutterRustBridgeTaskConstMeta(
            debugName: "reset_position_estimate",
            argNames: [],
          );
    
      Future<String> processSensorData(
              {required String incomingData, dynamic hint}) =>
          _platform.executeNormal(FlutterRustBridgeTask(
            callFfi: (port_) => _platform.inner.wire_process_sensor_data(
                port_, _platform.api2wire_String(incomingData)),
            parseSuccessData: _wire2api_String,
            constMeta: kProcessSensorDataConstMeta,
            argValues: [incomingData],
            hint: hint,
          ));
    
      FlutterRustBridgeTaskConstMeta get kProcessSensorDataConstMeta =>
          const FlutterRustBridgeTaskConstMeta(
            debugName: "process_sensor_data",
            argNames: ["incomingData"],
          );
    
      Future<SensorData> parseSensorData(
              {required String incomingData, dynamic hint}) =>
          _platform.executeNormal(FlutterRustBridgeTask(
            callFfi: (port_) => _platform.inner.wire_parse_sensor_data(
                port_, _platform.api2wire_String(incomingData)),
            parseSuccessData: _wire2api_sensor_data,
            constMeta: kParseSensorDataConstMeta,
            argValues: [incomingData],
            hint: hint,
          ));
    
      FlutterRustBridgeTaskConstMeta get kParseSensorDataConstMeta =>
          const FlutterRustBridgeTaskConstMeta(
            debugName: "parse_sensor_data",
            argNames: ["incomingData"],
          );
    
    // Section: wire2api
    
      String _wire2api_String(dynamic raw) {
        return raw as String;
      }
    
      Uint8List _wire2api_ZeroCopyBuffer_Uint8List(dynamic raw) {
        return raw as Uint8List;
      }
    
      bool _wire2api_bool(dynamic raw) {
        return raw as bool;
      }
    
      CorrelationFlow _wire2api_correlation_flow(dynamic raw) {
        final arr = raw as List<dynamic>;
        if (arr.length != 2)
          throw Exception('unexpected arr length: expect 2 but see ${arr.length}');
        return CorrelationFlow(
          dx: _wire2api_i16(arr[0]),
          dy: _wire2api_i16(arr[1]),
        );
      }
    
      int _wire2api_i16(dynamic raw) {
        return raw as int;
      }
    
      int _wire2api_i64(dynamic raw) {
        return castInt(raw);
      }
    
      SensorData _wire2api_sensor_data(dynamic raw) {
        final arr = raw as List<dynamic>;
        if (arr.length != 7)
          throw Exception('unexpected arr length: expect 7 but see ${arr.length}');
        return SensorData(
          sonarFront: _wire2api_i64(arr[0]),
          sonarLeft: _wire2api_i64(arr[1]),
          sonarRight: _wire2api_i64(arr[2]),
          leftCount: _wire2api_i64(arr[3]),
          rightCount: _wire2api_i64(arr[4]),
          leftSpeed: _wire2api_i64(arr[5]),
          rightSpeed: _wire2api_i64(arr[6]),
        );
      }
    
      int _wire2api_u8(dynamic raw) {
        return raw as int;
      }
    
      Uint8List _wire2api_uint_8_list(dynamic raw) {
        return raw as Uint8List;
      }
    
      void _wire2api_unit(dynamic raw) {
        return;
      }
    }
    
    // Section: api2wire
    
    @protected
    int api2wire_u8(int raw) {
      return raw;
    }
    
    class NativePlatform extends FlutterRustBridgeBase<NativeWire> {
      NativePlatform(ffi.DynamicLibrary dylib) : super(NativeWire(dylib));
    // Section: api2wire
    
      @protected
      ffi.Pointer<wire_uint_8_list> api2wire_String(String raw) {
        return api2wire_uint_8_list(utf8.encoder.convert(raw));
      }
    
      @protected
      ffi.Pointer<wire_ImageData> api2wire_box_autoadd_image_data(ImageData raw) {
        final ptr = inner.new_box_autoadd_image_data_0();
        _api_fill_to_wire_image_data(raw, ptr.ref);
        return ptr;
      }
    
      @protected
      int api2wire_i64(int raw) {
        return raw;
      }
    
      @protected
      ffi.Pointer<wire_uint_8_list> api2wire_uint_8_list(Uint8List raw) {
        final ans = inner.new_uint_8_list_0(raw.length);
        ans.ref.ptr.asTypedList(raw.length).setAll(0, raw);
        return ans;
      }
    // Section: api_fill_to_wire
    
      void _api_fill_to_wire_box_autoadd_image_data(
          ImageData apiObj, ffi.Pointer<wire_ImageData> wireObj) {
        _api_fill_to_wire_image_data(apiObj, wireObj.ref);
      }
    
      void _api_fill_to_wire_image_data(ImageData apiObj, wire_ImageData wireObj) {
        wireObj.ys = api2wire_uint_8_list(apiObj.ys);
        wireObj.us = api2wire_uint_8_list(apiObj.us);
        wireObj.vs = api2wire_uint_8_list(apiObj.vs);
        wireObj.width = api2wire_i64(apiObj.width);
        wireObj.height = api2wire_i64(apiObj.height);
        wireObj.uv_row_stride = api2wire_i64(apiObj.uvRowStride);
        wireObj.uv_pixel_stride = api2wire_i64(apiObj.uvPixelStride);
      }
    }
    
    // ignore_for_file: camel_case_types, non_constant_identifier_names, avoid_positional_boolean_parameters, annotate_overrides, constant_identifier_names
    
    // AUTO GENERATED FILE, DO NOT EDIT.
    //
    // Generated by `package:ffigen`.
    
    /// generated by flutter_rust_bridge
    class NativeWire implements FlutterRustBridgeWireBase {
      /// Holds the symbol lookup function.
      final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
          _lookup;
    
      /// The symbols are looked up in [dynamicLibrary].
      NativeWire(ffi.DynamicLibrary dynamicLibrary)
          : _lookup = dynamicLibrary.lookup;
    
      /// The symbols are looked up with [lookup].
      NativeWire.fromLookup(
          ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
              lookup)
          : _lookup = lookup;
    
      void store_dart_post_cobject(
        DartPostCObjectFnType ptr,
      ) {
        return _store_dart_post_cobject(
          ptr,
        );
      }
    
      late final _store_dart_post_cobjectPtr =
          _lookup<ffi.NativeFunction<ffi.Void Function(DartPostCObjectFnType)>>(
              'store_dart_post_cobject');
      late final _store_dart_post_cobject = _store_dart_post_cobjectPtr
          .asFunction<void Function(DartPostCObjectFnType)>();
    
      void wire_kmeans_ready(
        int port_,
      ) {
        return _wire_kmeans_ready(
          port_,
        );
      }
    
      late final _wire_kmeans_readyPtr =
          _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64)>>(
              'wire_kmeans_ready');
      late final _wire_kmeans_ready =
          _wire_kmeans_readyPtr.asFunction<void Function(int)>();
    
      void wire_training_time(
        int port_,
      ) {
        return _wire_training_time(
          port_,
        );
      }
    
      late final _wire_training_timePtr =
          _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64)>>(
              'wire_training_time');
      late final _wire_training_time =
          _wire_training_timePtr.asFunction<void Function(int)>();
    
      void wire_intensity_rgba(
        int port_,
        ffi.Pointer<wire_uint_8_list> intensities,
      ) {
        return _wire_intensity_rgba(
          port_,
          intensities,
        );
      }
    
      late final _wire_intensity_rgbaPtr = _lookup<
          ffi.NativeFunction<
              ffi.Void Function(ffi.Int64,
                  ffi.Pointer<wire_uint_8_list>)>>('wire_intensity_rgba');
      late final _wire_intensity_rgba = _wire_intensity_rgbaPtr
          .asFunction<void Function(int, ffi.Pointer<wire_uint_8_list>)>();
    
      void wire_yuv_rgba(
        int port_,
        ffi.Pointer<wire_ImageData> img,
      ) {
        return _wire_yuv_rgba(
          port_,
          img,
        );
      }
    
      late final _wire_yuv_rgbaPtr = _lookup<
          ffi.NativeFunction<
              ffi.Void Function(
                  ffi.Int64, ffi.Pointer<wire_ImageData>)>>('wire_yuv_rgba');
      late final _wire_yuv_rgba = _wire_yuv_rgbaPtr
          .asFunction<void Function(int, ffi.Pointer<wire_ImageData>)>();
    
      void wire_color_count(
        int port_,
        ffi.Pointer<wire_ImageData> img,
      ) {
        return _wire_color_count(
          port_,
          img,
        );
      }
    
      late final _wire_color_countPtr = _lookup<
          ffi.NativeFunction<
              ffi.Void Function(
                  ffi.Int64, ffi.Pointer<wire_ImageData>)>>('wire_color_count');
      late final _wire_color_count = _wire_color_countPtr
          .asFunction<void Function(int, ffi.Pointer<wire_ImageData>)>();
    
      void wire_groundline_sample_overlay(
        int port_,
        ffi.Pointer<wire_ImageData> img,
      ) {
        return _wire_groundline_sample_overlay(
          port_,
          img,
        );
      }
    
      late final _wire_groundline_sample_overlayPtr = _lookup<
          ffi.NativeFunction<
              ffi.Void Function(ffi.Int64,
                  ffi.Pointer<wire_ImageData>)>>('wire_groundline_sample_overlay');
      late final _wire_groundline_sample_overlay =
          _wire_groundline_sample_overlayPtr
              .asFunction<void Function(int, ffi.Pointer<wire_ImageData>)>();
    
      void wire_start_kmeans_training(
        int port_,
        ffi.Pointer<wire_ImageData> img,
      ) {
        return _wire_start_kmeans_training(
          port_,
          img,
        );
      }
    
      late final _wire_start_kmeans_trainingPtr = _lookup<
          ffi.NativeFunction<
              ffi.Void Function(ffi.Int64,
                  ffi.Pointer<wire_ImageData>)>>('wire_start_kmeans_training');
      late final _wire_start_kmeans_training = _wire_start_kmeans_trainingPtr
          .asFunction<void Function(int, ffi.Pointer<wire_ImageData>)>();
    
      void wire_color_clusterer(
        int port_,
        ffi.Pointer<wire_ImageData> img,
      ) {
        return _wire_color_clusterer(
          port_,
          img,
        );
      }
    
      late final _wire_color_clustererPtr = _lookup<
          ffi.NativeFunction<
              ffi.Void Function(
                  ffi.Int64, ffi.Pointer<wire_ImageData>)>>('wire_color_clusterer');
      late final _wire_color_clusterer = _wire_color_clustererPtr
          .asFunction<void Function(int, ffi.Pointer<wire_ImageData>)>();
    
      void wire_groundline_k_means(
        int port_,
        ffi.Pointer<wire_ImageData> img,
      ) {
        return _wire_groundline_k_means(
          port_,
          img,
        );
      }
    
      late final _wire_groundline_k_meansPtr = _lookup<
          ffi.NativeFunction<
              ffi.Void Function(ffi.Int64,
                  ffi.Pointer<wire_ImageData>)>>('wire_groundline_k_means');
      late final _wire_groundline_k_means = _wire_groundline_k_meansPtr
          .asFunction<void Function(int, ffi.Pointer<wire_ImageData>)>();
    
      void wire_get_correlation_flow(
        int port_,
        ffi.Pointer<wire_uint_8_list> prev_ys,
        ffi.Pointer<wire_uint_8_list> current_ys,
        int width,
        int height,
      ) {
        return _wire_get_correlation_flow(
          port_,
          prev_ys,
          current_ys,
          width,
          height,
        );
      }
    
      late final _wire_get_correlation_flowPtr = _lookup<
          ffi.NativeFunction<
              ffi.Void Function(
                  ffi.Int64,
                  ffi.Pointer<wire_uint_8_list>,
                  ffi.Pointer<wire_uint_8_list>,
                  ffi.Int64,
                  ffi.Int64)>>('wire_get_correlation_flow');
      late final _wire_get_correlation_flow =
          _wire_get_correlation_flowPtr.asFunction<
              void Function(int, ffi.Pointer<wire_uint_8_list>,
                  ffi.Pointer<wire_uint_8_list>, int, int)>();
    
      void wire_reset_position_estimate(
        int port_,
      ) {
        return _wire_reset_position_estimate(
          port_,
        );
      }
    
      late final _wire_reset_position_estimatePtr =
          _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64)>>(
              'wire_reset_position_estimate');
      late final _wire_reset_position_estimate =
          _wire_reset_position_estimatePtr.asFunction<void Function(int)>();
    
      void wire_process_sensor_data(
        int port_,
        ffi.Pointer<wire_uint_8_list> incoming_data,
      ) {
        return _wire_process_sensor_data(
          port_,
          incoming_data,
        );
      }
    
      late final _wire_process_sensor_dataPtr = _lookup<
          ffi.NativeFunction<
              ffi.Void Function(ffi.Int64,
                  ffi.Pointer<wire_uint_8_list>)>>('wire_process_sensor_data');
      late final _wire_process_sensor_data = _wire_process_sensor_dataPtr
          .asFunction<void Function(int, ffi.Pointer<wire_uint_8_list>)>();
    
      void wire_parse_sensor_data(
        int port_,
        ffi.Pointer<wire_uint_8_list> incoming_data,
      ) {
        return _wire_parse_sensor_data(
          port_,
          incoming_data,
        );
      }
    
      late final _wire_parse_sensor_dataPtr = _lookup<
          ffi.NativeFunction<
              ffi.Void Function(ffi.Int64,
                  ffi.Pointer<wire_uint_8_list>)>>('wire_parse_sensor_data');
      late final _wire_parse_sensor_data = _wire_parse_sensor_dataPtr
          .asFunction<void Function(int, ffi.Pointer<wire_uint_8_list>)>();
    
      ffi.Pointer<wire_ImageData> new_box_autoadd_image_data_0() {
        return _new_box_autoadd_image_data_0();
      }
    
      late final _new_box_autoadd_image_data_0Ptr =
          _lookup<ffi.NativeFunction<ffi.Pointer<wire_ImageData> Function()>>(
              'new_box_autoadd_image_data_0');
      late final _new_box_autoadd_image_data_0 = _new_box_autoadd_image_data_0Ptr
          .asFunction<ffi.Pointer<wire_ImageData> Function()>();
    
      ffi.Pointer<wire_uint_8_list> new_uint_8_list_0(
        int len,
      ) {
        return _new_uint_8_list_0(
          len,
        );
      }
    
      late final _new_uint_8_list_0Ptr = _lookup<
          ffi.NativeFunction<
              ffi.Pointer<wire_uint_8_list> Function(
                  ffi.Int32)>>('new_uint_8_list_0');
      late final _new_uint_8_list_0 = _new_uint_8_list_0Ptr
          .asFunction<ffi.Pointer<wire_uint_8_list> Function(int)>();
    
      void free_WireSyncReturnStruct(
        WireSyncReturnStruct val,
      ) {
        return _free_WireSyncReturnStruct(
          val,
        );
      }
    
      late final _free_WireSyncReturnStructPtr =
          _lookup<ffi.NativeFunction<ffi.Void Function(WireSyncReturnStruct)>>(
              'free_WireSyncReturnStruct');
      late final _free_WireSyncReturnStruct = _free_WireSyncReturnStructPtr
          .asFunction<void Function(WireSyncReturnStruct)>();
    }
    
    class wire_uint_8_list extends ffi.Struct {
      external ffi.Pointer<ffi.Uint8> ptr;
    
      @ffi.Int32()
      external int len;
    }
    
    class wire_ImageData extends ffi.Struct {
      external ffi.Pointer<wire_uint_8_list> ys;
    
      external ffi.Pointer<wire_uint_8_list> us;
    
      external ffi.Pointer<wire_uint_8_list> vs;
    
      @ffi.Int64()
      external int width;
    
      @ffi.Int64()
      external int height;
    
      @ffi.Int64()
      external int uv_row_stride;
    
      @ffi.Int64()
      external int uv_pixel_stride;
    }
    
    typedef DartPostCObjectFnType = ffi.Pointer<
        ffi.NativeFunction<ffi.Bool Function(DartPort, ffi.Pointer<ffi.Void>)>>;
    typedef DartPort = ffi.Int64;
    
    // AUTO GENERATED FILE, DO NOT EDIT.
    // Generated by `flutter_rust_bridge`@ 1.49.0.
    // ignore_for_file: non_constant_identifier_names, unused_element, duplicate_ignore, directives_ordering, curly_braces_in_flow_control_structures, unnecessary_lambdas, slash_for_doc_comments, prefer_const_literals_to_create_immutables, implicit_dynamic_list_literal, duplicate_import, unused_import, prefer_single_quotes, prefer_const_constructors, use_super_parameters, always_use_package_imports, annotate_overrides, invalid_use_of_protected_member, constant_identifier_names
    
    import 'dart:convert';
    import 'dart:async';
    import 'package:flutter_rust_bridge/flutter_rust_bridge.dart';
    
    abstract class Native {
      Future<bool> kmeansReady({dynamic hint});
    
      FlutterRustBridgeTaskConstMeta get kKmeansReadyConstMeta;
    
      Future<int> trainingTime({dynamic hint});
    
      FlutterRustBridgeTaskConstMeta get kTrainingTimeConstMeta;
    
      Future<Uint8List> intensityRgba(
          {required Uint8List intensities, dynamic hint});
    
      FlutterRustBridgeTaskConstMeta get kIntensityRgbaConstMeta;
    
      Future<Uint8List> yuvRgba({required ImageData img, dynamic hint});
    
      FlutterRustBridgeTaskConstMeta get kYuvRgbaConstMeta;
    
      Future<int> colorCount({required ImageData img, dynamic hint});
    
      FlutterRustBridgeTaskConstMeta get kColorCountConstMeta;
    
      Future<Uint8List> groundlineSampleOverlay(
          {required ImageData img, dynamic hint});
    
      FlutterRustBridgeTaskConstMeta get kGroundlineSampleOverlayConstMeta;
    
      Future<void> startKmeansTraining({required ImageData img, dynamic hint});
    
      FlutterRustBridgeTaskConstMeta get kStartKmeansTrainingConstMeta;
    
      Future<Uint8List> colorClusterer({required ImageData img, dynamic hint});
    
      FlutterRustBridgeTaskConstMeta get kColorClustererConstMeta;
    
      Future<Uint8List> groundlineKMeans({required ImageData img, dynamic hint});
    
      FlutterRustBridgeTaskConstMeta get kGroundlineKMeansConstMeta;
    
      Future<CorrelationFlow> getCorrelationFlow(
          {required Uint8List prevYs,
          required Uint8List currentYs,
          required int width,
          required int height,
          dynamic hint});
    
      FlutterRustBridgeTaskConstMeta get kGetCorrelationFlowConstMeta;
    
      Future<void> resetPositionEstimate({dynamic hint});
    
      FlutterRustBridgeTaskConstMeta get kResetPositionEstimateConstMeta;
    
      Future<String> processSensorData(
          {required String incomingData, dynamic hint});
    
      FlutterRustBridgeTaskConstMeta get kProcessSensorDataConstMeta;
    
      Future<SensorData> parseSensorData(
          {required String incomingData, dynamic hint});
    
      FlutterRustBridgeTaskConstMeta get kParseSensorDataConstMeta;
    }
    
    class CorrelationFlow {
      final int dx;
      final int dy;
    
      CorrelationFlow({
        required this.dx,
        required this.dy,
      });
    }
    
    class ImageData {
      final Uint8List ys;
      final Uint8List us;
      final Uint8List vs;
      final int width;
      final int height;
      final int uvRowStride;
      final int uvPixelStride;
    
      ImageData({
        required this.ys,
        required this.us,
        required this.vs,
        required this.width,
        required this.height,
        required this.uvRowStride,
        required this.uvPixelStride,
      });
    }
    
    class SensorData {
      final int sonarFront;
      final int sonarLeft;
      final int sonarRight;
      final int leftCount;
      final int rightCount;
      final int leftSpeed;
      final int rightSpeed;
    
      SensorData({
        required this.sonarFront,
        required this.sonarLeft,
        required this.sonarRight,
        required this.leftCount,
        required this.rightCount,
        required this.leftSpeed,
        required this.rightSpeed,
      });
    }
    

    OS

    Windows

    Version of flutter_rust_bridge_codegen

    1.53.0

    Flutter info

    PS C:\Users\ferrer\AndroidStudioProjects\groundline> flutter doctor -v
    [√] Flutter (Channel stable, 3.3.9, on Microsoft Windows [Version 10.0.19043.1288], locale en-US)
        • Flutter version 3.3.9 on channel stable at C:\Users\ferrer\flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision b8f7f1f986 (2 weeks ago), 2022-11-23 06:43:51 +0900
        • Engine revision 8f2221fbef
        • Dart version 2.18.5
        • DevTools version 2.15.0
    
    [√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
        • Android SDK at C:\Users\ferrer\AppData\Local\Android\Sdk
        • Platform android-33, build-tools 30.0.3
        • ANDROID_HOME = C:\Users\ferrer\AppData\Local\Android\Sdk
        • Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
        • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
        • All Android licenses accepted.
    
    [√] Chrome - develop for the web
        • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
    
    [√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.3.6)
        • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
        • Visual Studio Community 2019 version 16.3.29418.71
        • Windows 10 SDK version 10.0.18362.0
    
    [!] Android Studio (version 3.5)
        • Android Studio at C:\Program Files\Android\Android Studio
        • Flutter plugin version 44.0.1
        • Dart plugin version 191.8593
        X Unable to determine bundled Java version.
        • Try updating or re-installing Android Studio.
    
    [√] Android Studio (version 2021.2)
        • Android Studio at C:\Program Files\Android\Android Studio1
        • Flutter plugin can be installed from:
           https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
           https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
    
    [√] IntelliJ IDEA Community Edition (version 2022.2)
        • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.2.2
        • Flutter plugin can be installed from:
           https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
           https://plugins.jetbrains.com/plugin/6351-dart
    
    [√] VS Code, 64-bit edition (version 1.73.1)
        • VS Code at C:\Program Files\Microsoft VS Code
        • Flutter extension can be installed from:
           https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
    
    [√] Connected device (4 available)
        • KFAUWI (mobile)   • G0W0MA078282F7EP • android-arm    • Android 5.1.1 (API 22)
        • Windows (desktop) • windows          • windows-x64    • Microsoft Windows [Version 10.0.19043.1288]
        • Chrome (web)      • chrome           • web-javascript • Google Chrome 108.0.5359.71
        • Edge (web)        • edge             • web-javascript • Microsoft Edge 107.0.1418.62
    
    [√] HTTP Host Availability
        • All required HTTP hosts are available
    
    ! Doctor found issues in 1 category.
    PS C:\Users\ferrer\AndroidStudioProjects\groundline>
    

    Version of clang++

    No response

    Version of ffigen

    7.2.2

    Additional context

    No response

    bug 
    opened by gjf2a 45
  • Supporting methods

    Supporting methods

    ULTRA draft, just a request for how to go in this. Also I don't promise it will be done, I just want to see how hard would it be.

    @fzyzcjy please look at frb_codegen/src/parser/mod.rs

    here I parse methods. What do you think of transforming a method to a function which receives a reference of the Self type?

    For example

    pub struct StructWithMethod{
        something: String
    }
    
    impl StructWithMethod {
        pub fn do_something(&self, _u: u32) {
            todo!()
        }
    }
    

    would turn into

    pub fn struct_with_method_do_something(self_object: &StructWithMethod, _u: u32) {
    //...
    }
    

    if done like this, then I'd do something like this

    if let Item::Impl(ref item_impl) = item {
                for item in &item_impl.items {
                    if let ImplItem::Method(item_method) = item {
                        if let Visibility::Public(_) = &item_method.vis {
                            let item_fn = modify_method_to_function(item_method);
                            src_fns.push(item_fn);
                        }
                    }
                }
            }
    

    where modify_method_to_function would just create a function out of the method.

    Close #539 Close #67

    opened by lattice0 43
  • Implement Wire2Api<[T; N]> & refactor dart tests

    Implement Wire2Api<[T; N]> & refactor dart tests

    I've noticed that [T; N] is only half way implemented. Rust functions that take [T; N] as an argument don't generate and functions that take a struct with an array field don't build. The first fails with cannot parse argument... and the latter with `the trait Wire2Api<> is not implemented. I works if I manually add

    impl<const N: usize> Wire2Api<[u8; N]> for *mut wire_uint_8_list {
       fn wire2api(self) -> [u8; N] {
           unsafe {
               let wrap = support::box_from_leak_ptr(self);
               std::slice::from_raw_parts(wrap.ptr, wrap.len as usize)
                   .try_into()
                   .unwrap()
           }
       }
    }
    

    into bridge_generated.rs.

    To my knowlegde there don't exist fixed length lists in Dart, only lists with growable = false, so I'm not sure what's the best approach here...any ideas?

    opened by trobanga 42
  • Make sync mode support whatever types that classical async mode supports

    Make sync mode support whatever types that classical async mode supports

    Fixes #881

    I've thought a lot through which solution could be best, and figured that matching async API was the best. It makes the code simple and efficient.

    I've dug through serialization too but figured it will always need work when adding new features to the bridge. The simplest and most efficient "serialization" already exists: the FFI bindings that represents dart objects. The only issue was that these bindings are blackboxed on dart-sdk's side, which left me no better solution than reimplementing those conversions and even the FFI itself.

    However the cost of these changes it pretty low and comparable to implementing custom bytes deserialization.

    I'm pretty happy of this solution and I call your attention in case I missed something important, esp. @rogurotus who recently made work that could overlap mine (I already read it all and I think we're fine)

    Checklist

    • [x] Validate the solution with the team
    • [x] Reimplement DartCObject on the dart side to seamlessly match async API
    • [x] Simulate WireSyncReturnStruct being opaque in generated code, which avoids keeping it synchronized with the actual rust code. Its FFI bindings are already written in frb_dart anyways.
    • [x] Preserve memory safety (double checks are welcome)
    • [x] New tests are added to ensure new features are working. End-to-end tests are usually in the ./frb_example/pure_dart example, more specifically, rust/src/api.rs and dart/lib/main.dart.
    • [x] The code generator is run and the code is formatted (e.g. via just refresh_all).
    • [x] If this PR adds/changes features, documentations (in the ./book folder) are updated.
    Remark for PR creator
    • New contributors will be blocked by GitHub from running CI, but you can use a trick to workaround this, and verify your code using CI by yourself.
    • If fzyzcjy does not reply for a few days, maybe he just did not see it, so please ping him.
    opened by ngasull 36
  • [Bug] Failed to lookup symbol 'store_dart_post_cobject'

    [Bug] Failed to lookup symbol 'store_dart_post_cobject'

    Describe the bug

    Ok, this is the well-known bug that has been reported many times already. I got it in the past and got rid of it by following people's recommendations in Discussions or Issues. This time I'm stuck with this bug for over a couple of weeks and until now it was fine because I'll just run just test-pure-web instead or peek at the CI worklows execution (which just works fine, contrary to my machine lol). But this time I'm testing something and I would really like to be able to run just test-pure locally and track my progress here.

    I've already tried a bunch of stuff before opening this Issue, also fixed paths around (now that we switched to cargo workspace, the target folder is systematically in root folder, not in each crate's folder).

    Codegen logs with RUST_LOG=debug environment variable

    click to display
    ➜  frb_example git:(experiment) ✗ RUST_LOG=debug just refresh_all           
    just gen-help
    cargo run --manifest-path frb_codegen/Cargo.toml -- --help > book/src/help.txt
       Compiling flutter_rust_bridge_codegen v1.48.0 (/Users/romain/Development/contributions/flutter_rust_bridge/frb_codegen)
        Finished dev [unoptimized + debuginfo] target(s) in 3.01s
         Running `target/debug/flutter_rust_bridge_codegen --help`
    dart run frb_dart/bin/serve.dart --help > book/src/help.serve.txt
    just gen-bridge 
    cd frb_codegen && cargo build
        Finished dev [unoptimized + debuginfo] target(s) in 0.06s
    (cd frb_example/with_flutter && flutter pub get)
    Running "flutter pub get" in with_flutter...                     2,383ms
    cargo run --manifest-path frb_codegen/Cargo.toml -- -r frb_example/with_flutter/rust/src/api.rs -d frb_example/with_flutter/lib/bridge_generated.dart --dart-decl-output frb_example/with_flutter/lib/bridge_definitions.dart -c frb_example/with_flutter/ios/Runner/bridge_generated.h -c frb_example/with_flutter/macos/Runner/bridge_generated.h --dart-format-line-length 120 --wasm
        Finished dev [unoptimized + debuginfo] target(s) in 0.05s
         Running `target/debug/flutter_rust_bridge_codegen -r frb_example/with_flutter/rust/src/api.rs -d frb_example/with_flutter/lib/bridge_generated.dart --dart-decl-output frb_example/with_flutter/lib/bridge_definitions.dart -c frb_example/with_flutter/ios/Runner/bridge_generated.h -c frb_example/with_flutter/macos/Runner/bridge_generated.h --dart-format-line-length 120 --wasm`
    [2022-09-30T09:56:29Z DEBUG flutter_rust_bridge_codegen] configs=[Opts { rust_input_path: "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/api.rs", dart_output_path: "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.dart", dart_decl_output_path: Some("/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_definitions.dart"), c_output_path: ["/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/ios/Runner/bridge_generated.h", "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/macos/Runner/bridge_generated.h"], rust_crate_dir: "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust", rust_output_path: "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.rs", class_name: "FlutterRustBridgeExample", dart_format_line_length: 120, skip_add_mod_to_lib: false, llvm_path: ["/opt/homebrew/opt/llvm", "/usr/local/opt/llvm", "/usr/lib/llvm-9", "/usr/lib/llvm-10", "/usr/lib/llvm-11", "/usr/lib/llvm-12", "/usr/lib/llvm-13", "/usr/lib/llvm-14", "/usr/lib/", "/usr/lib64/", "C:/Program Files/llvm", "C:/msys64/mingw64"], compiler_opts: "", manifest_path: "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/Cargo.toml", dart_root: Some("/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter"), build_runner: true, block_index: BlockIndex(0), skip_deps_check: false, wasm_enabled: true, inline_rust: false, bench_extended: true }]
    [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::source_graph] Trying to parse "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/api.rs"
    [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::source_graph] Trying to parse "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.rs"
    [2022-09-30T09:56:29Z WARN  lib_flutter_rust_bridge_codegen::source_graph] Skipping unresolvable module web (tried /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/web.rs, /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/web/mod.rs, /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated/web.rs, /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated/web/mod.rs, )
    [2022-09-30T09:56:29Z WARN  lib_flutter_rust_bridge_codegen::source_graph] Skipping unresolvable module io (tried /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/io.rs, /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/io/mod.rs, /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated/io.rs, /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated/io/mod.rs, )
    [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::source_graph] Trying to parse "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/off_topic_code.rs"
    [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(draw_mandelbrot)
    [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(passing_complex_structs)
    [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(returning_structs_with_boxed_fields)
    [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_input_array)
    [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_output_zero_copy_buffer)
    [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_output_vec_u8)
    [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_input_vec_of_object)
    [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_output_vec_of_object)
    [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_input_complex_struct)
    [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_output_complex_struct)
    [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_deliberately_return_error)
    [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_deliberately_panic)
    [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::tools] Guessing toolchain the runner is run into
    [2022-09-30T09:56:29Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute command: bin=sh args="-c \"flutter\" \"--version\"" current_dir=None cmd="sh" "-c" "\"flutter\" \"--version\""
    Flutter 3.3.3 • channel stable • https://github.com/flutter/flutter.git
    Framework • revision 18a827f393 (2 days ago) • 2022-09-28 10:03:14 -0700
    Engine • revision 5c984c26eb
    Tools • Dart 2.18.2 • DevTools 2.15.0
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::commands] command="sh" "-c" "\"flutter\" \"--version\"" stdout= stderr=
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::tools] Checking presence of ffi in dependencies at /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::tools] Checking presence of ffi in dependencies at /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::tools] Checking presence of ffigen in dev_dependencies at /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::tools] Checking presence of ffigen in dev_dependencies at /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter
    [2022-09-30T09:56:30Z INFO  lib_flutter_rust_bridge_codegen] Picked config: Opts { rust_input_path: "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/api.rs", dart_output_path: "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.dart", dart_decl_output_path: Some("/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_definitions.dart"), c_output_path: ["/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/ios/Runner/bridge_generated.h", "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/macos/Runner/bridge_generated.h"], rust_crate_dir: "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust", rust_output_path: "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.rs", class_name: "FlutterRustBridgeExample", dart_format_line_length: 120, skip_add_mod_to_lib: false, llvm_path: ["/opt/homebrew/opt/llvm", "/usr/local/opt/llvm", "/usr/lib/llvm-9", "/usr/lib/llvm-10", "/usr/lib/llvm-11", "/usr/lib/llvm-12", "/usr/lib/llvm-13", "/usr/lib/llvm-14", "/usr/lib/", "/usr/lib64/", "C:/Program Files/llvm", "C:/msys64/mingw64"], compiler_opts: "", manifest_path: "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/Cargo.toml", dart_root: Some("/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter"), build_runner: true, block_index: BlockIndex(0), skip_deps_check: false, wasm_enabled: true, inline_rust: false, bench_extended: true }
    [2022-09-30T09:56:30Z INFO  lib_flutter_rust_bridge_codegen] Phase: Parse source code to AST, then to IR
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::source_graph] Trying to parse "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/api.rs"
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::source_graph] Trying to parse "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.rs"
    [2022-09-30T09:56:30Z WARN  lib_flutter_rust_bridge_codegen::source_graph] Skipping unresolvable module web (tried /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/web.rs, /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/web/mod.rs, /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated/web.rs, /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated/web/mod.rs, )
    [2022-09-30T09:56:30Z WARN  lib_flutter_rust_bridge_codegen::source_graph] Skipping unresolvable module io (tried /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/io.rs, /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/io/mod.rs, /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated/io.rs, /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated/io/mod.rs, )
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::source_graph] Trying to parse "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/off_topic_code.rs"
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(draw_mandelbrot)
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(passing_complex_structs)
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(returning_structs_with_boxed_fields)
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_input_array)
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_output_zero_copy_buffer)
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_output_vec_u8)
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_input_vec_of_object)
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_output_vec_of_object)
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_input_complex_struct)
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_memory_test_output_complex_struct)
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_deliberately_return_error)
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::parser] parse_function function name: Ident(off_topic_deliberately_panic)
    [2022-09-30T09:56:30Z INFO  lib_flutter_rust_bridge_codegen] Phase: Transform IR
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::transformer] transform_func_input_add_boxed wrap Boxed to field=IrField { ty: StructRef(IrTypeStructRef { name: "Size", freezed: false }), name: IrIdent { raw: "image_size" }, is_final: true, comments: [] }
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::transformer] transform_func_input_add_boxed wrap Boxed to field=IrField { ty: StructRef(IrTypeStructRef { name: "Point", freezed: false }), name: IrIdent { raw: "zoom_point" }, is_final: true, comments: [] }
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::transformer] transform_func_input_add_boxed wrap Boxed to field=IrField { ty: StructRef(IrTypeStructRef { name: "TreeNode", freezed: false }), name: IrIdent { raw: "root" }, is_final: true, comments: [] }
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::transformer] transform_func_input_add_boxed wrap Boxed to field=IrField { ty: StructRef(IrTypeStructRef { name: "TreeNode", freezed: false }), name: IrIdent { raw: "input" }, is_final: true, comments: [] }
    [2022-09-30T09:56:30Z INFO  lib_flutter_rust_bridge_codegen] Phase: Generate Rust code
    [2022-09-30T09:56:30Z INFO  lib_flutter_rust_bridge_codegen] Phase: Generate Dart code
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::generator::dart] distinct_input_types=[Delegate(String), Boxed(IrTypeBoxed { exist_in_real_api: false, inner: StructRef(IrTypeStructRef { name: "Point", freezed: false }) }), Boxed(IrTypeBoxed { exist_in_real_api: false, inner: StructRef(IrTypeStructRef { name: "Size", freezed: false }) }), Boxed(IrTypeBoxed { exist_in_real_api: false, inner: StructRef(IrTypeStructRef { name: "TreeNode", freezed: false }) }), Primitive(F64), Primitive(I32), GeneralList(IrTypeGeneralList { inner: StructRef(IrTypeStructRef { name: "Size", freezed: false }) }), GeneralList(IrTypeGeneralList { inner: StructRef(IrTypeStructRef { name: "TreeNode", freezed: false }) }), StructRef(IrTypeStructRef { name: "Point", freezed: false }), StructRef(IrTypeStructRef { name: "Size", freezed: false }), StructRef(IrTypeStructRef { name: "TreeNode", freezed: false }), Primitive(U8), PrimitiveList(IrTypePrimitiveList { primitive: U8 })]
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::generator::dart] distinct_output_types=[Delegate(String), Delegate(ZeroCopyBufferVecPrimitive(U8)), Boxed(IrTypeBoxed { exist_in_real_api: true, inner: StructRef(IrTypeStructRef { name: "Point", freezed: false }) }), StructRef(IrTypeStructRef { name: "BoxedPoint", freezed: false }), Primitive(F64), Primitive(I32), GeneralList(IrTypeGeneralList { inner: StructRef(IrTypeStructRef { name: "Size", freezed: false }) }), GeneralList(IrTypeGeneralList { inner: StructRef(IrTypeStructRef { name: "TreeNode", freezed: false }) }), StructRef(IrTypeStructRef { name: "Point", freezed: false }), StructRef(IrTypeStructRef { name: "Size", freezed: false }), StructRef(IrTypeStructRef { name: "TreeNode", freezed: false }), Primitive(U8), PrimitiveList(IrTypePrimitiveList { primitive: U8 })]
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute format_rust path=["/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.rs", "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.io.rs", "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.web.rs"]
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute command: bin=rustfmt args="/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.rs /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.io.rs /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.web.rs" current_dir=None cmd="rustfmt" "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.rs" "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.io.rs" "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.web.rs"
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::commands] command="rustfmt" "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.rs" "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.io.rs" "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust/src/bridge_generated.web.rs" stdout= stderr=
    [2022-09-30T09:56:30Z INFO  lib_flutter_rust_bridge_codegen] Phase: Generating Dart bindings for Rust
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute cbindgen rust_crate_dir=/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust c_output_path=/var/folders/st/8cddrx857yj1gh8yvj0j499c0000gn/T/.tmpnaQERP.h
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::commands] cbindgen config: Config {
            header: None,
            includes: [],
            sys_includes: [
                "stdbool.h",
                "stdint.h",
                "stdlib.h",
            ],
            after_includes: None,
            trailer: None,
            include_guard: None,
            pragma_once: false,
            no_includes: true,
            autogen_warning: None,
            include_version: false,
            namespace: None,
            namespaces: None,
            using_namespaces: None,
            braces: SameLine,
            line_length: 100,
            tab_width: 2,
            line_endings: LF,
            language: C,
            cpp_compat: false,
            style: Both,
            sort_by: None,
            usize_is_size_t: false,
            parse: ParseConfig {
                parse_deps: false,
                include: None,
                exclude: [],
                expand: ParseExpandConfig {
                    crates: [],
                    all_features: false,
                    default_features: true,
                    features: None,
                    profile: Debug,
                },
                clean: false,
                extra_bindings: [],
            },
            export: ExportConfig {
                include: [
                    "\"wire_BoxedPoint\"",
                    "\"wire_Point\"",
                    "\"wire_Size\"",
                    "\"wire_TreeNode\"",
                ],
                exclude: [],
                rename: {},
                pre_body: {},
                body: {},
                prefix: None,
                item_types: [],
                renaming_overrides_prefixing: false,
                mangle: MangleConfig {
                    rename_types: None,
                    remove_underscores: false,
                },
            },
            macro_expansion: MacroExpansionConfig {
                bitflags: false,
            },
            layout: LayoutConfig {
                packed: None,
                aligned_n: None,
            },
            function: FunctionConfig {
                prefix: None,
                postfix: None,
                must_use: None,
                args: Auto,
                rename_args: None,
                swift_name_macro: None,
                sort_by: None,
                no_return: None,
            },
            structure: StructConfig {
                rename_fields: None,
                derive_constructor: false,
                derive_eq: false,
                derive_neq: false,
                derive_lt: false,
                derive_lte: false,
                derive_gt: false,
                derive_gte: false,
                derive_ostream: false,
                associated_constants_in_body: false,
                must_use: None,
            },
            enumeration: EnumConfig {
                rename_variants: None,
                rename_variant_name_fields: SnakeCase,
                add_sentinel: false,
                prefix_with_name: false,
                derive_helper_methods: false,
                derive_const_casts: false,
                derive_mut_casts: false,
                cast_assert_name: None,
                must_use: None,
                derive_tagged_enum_destructor: false,
                derive_tagged_enum_copy_constructor: false,
                derive_tagged_enum_copy_assignment: false,
                derive_ostream: false,
                enum_class: true,
                private_default_tagged_enum_constructor: false,
            },
            constant: ConstantConfig {
                allow_static_const: true,
                allow_constexpr: true,
                sort_by: None,
            },
            defines: {},
            documentation: true,
            documentation_style: Auto,
            documentation_length: Full,
            pointer: PtrConfig {
                non_null_attribute: None,
            },
            only_target_dependencies: false,
            cython: CythonConfig {
                header: None,
                cimports: {},
            },
        }
    [2022-09-30T09:56:30Z DEBUG cbindgen::bindgen::parser] Parsing crate flutter_rust_bridge_example
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::Size - opaque (Struct is not marked #[repr(C)] or #[repr(transparent)].).
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::Point - opaque (Struct is not marked #[repr(C)] or #[repr(transparent)].).
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::TreeNode - opaque (Struct is not marked #[repr(C)] or #[repr(transparent)].).
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::BoxedPoint - opaque (Struct is not marked #[repr(C)] or #[repr(transparent)].).
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::DartPort.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::DartPostCObjectFnType.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::store_dart_post_cobject.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::WireSyncReturnStruct.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_draw_mandelbrot.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_passing_complex_structs.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_returning_structs_with_boxed_fields.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_off_topic_memory_test_input_array.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_off_topic_memory_test_output_zero_copy_buffer.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_off_topic_memory_test_output_vec_u8.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_off_topic_memory_test_input_vec_of_object.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_off_topic_memory_test_output_vec_of_object.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_off_topic_memory_test_input_complex_struct.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_off_topic_memory_test_output_complex_struct.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_off_topic_deliberately_return_error.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_off_topic_deliberately_panic.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::new_box_autoadd_point_0.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::new_box_autoadd_size_0.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::new_box_autoadd_tree_node_0.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::new_list_size_0.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::new_list_tree_node_0.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::new_uint_8_list_0.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_list_size.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_list_tree_node.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_Point.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_Size.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_TreeNode.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::wire_uint_8_list.
    [2022-09-30T09:56:30Z INFO  cbindgen::bindgen::parser] Take flutter_rust_bridge_example::free_WireSyncReturnStruct.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::parser] Skip flutter_rust_bridge_example::A - (not `pub`).
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::parser] Skip flutter_rust_bridge_example::B - (not `pub`).
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z WARN  cbindgen::bindgen::ir::cfg] Missing `[defines]` entry for `target_family = "wasm"` in cbindgen config.
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute ffigen c_path=/var/folders/st/8cddrx857yj1gh8yvj0j499c0000gn/T/.tmpnaQERP.h dart_path=/var/folders/st/8cddrx857yj1gh8yvj0j499c0000gn/T/.tmpdIiHAo llvm_path=["/opt/homebrew/opt/llvm", "/usr/local/opt/llvm", "/usr/lib/llvm-9", "/usr/lib/llvm-10", "/usr/lib/llvm-11", "/usr/lib/llvm-12", "/usr/lib/llvm-13", "/usr/lib/llvm-14", "/usr/lib/", "/usr/lib64/", "C:/Program Files/llvm", "C:/msys64/mingw64"]
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::commands] ffigen config: 
                output: '/var/folders/st/8cddrx857yj1gh8yvj0j499c0000gn/T/.tmpdIiHAo'
                name: 'FlutterRustBridgeExampleWire'
                description: 'generated by flutter_rust_bridge'
                headers:
                  entry-points:
                    - '/var/folders/st/8cddrx857yj1gh8yvj0j499c0000gn/T/.tmpnaQERP.h'
                  include-directives:
                    - '/var/folders/st/8cddrx857yj1gh8yvj0j499c0000gn/T/.tmpnaQERP.h'
                comments: false
                preamble: |
                  // ignore_for_file: camel_case_types, non_constant_identifier_names, avoid_positional_boolean_parameters, annotate_overrides, constant_identifier_names
                
                llvm-path:
                   - '/opt/homebrew/opt/llvm'
                   - '/usr/local/opt/llvm'
                   - '/usr/lib/llvm-9'
                   - '/usr/lib/llvm-10'
                   - '/usr/lib/llvm-11'
                   - '/usr/lib/llvm-12'
                   - '/usr/lib/llvm-13'
                   - '/usr/lib/llvm-14'
                   - '/usr/lib/'
                   - '/usr/lib64/'
                   - 'C:/Program Files/llvm'
                   - 'C:/msys64/mingw64'
        
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::commands] ffigen config_file: NamedTempFile("/var/folders/st/8cddrx857yj1gh8yvj0j499c0000gn/T/.tmpCxnKBA")
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::tools] Guessing toolchain the runner is run into
    [2022-09-30T09:56:30Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute command: bin=sh args="-c \"flutter\" \"pub\" \"run\" \"ffigen\" \"--config\" \"/var/folders/st/8cddrx857yj1gh8yvj0j499c0000gn/T/.tmpCxnKBA\"" current_dir=Some("/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter") cmd="sh" "-c" "\"flutter\" \"pub\" \"run\" \"ffigen\" \"--config\" \"/var/folders/st/8cddrx857yj1gh8yvj0j499c0000gn/T/.tmpCxnKBA\""
    Running in Directory: '/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter'
    Input Headers: [/var/folders/st/8cddrx857yj1gh8yvj0j499c0000gn/T/.tmpnaQERP.h]
    [SEVERE] : Header /var/folders/st/8cddrx857yj1gh8yvj0j499c0000gn/T/.tmpnaQERP.h: Total errors/warnings: 180.
    [SEVERE] :     /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:134:25: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [Nullability Issue]
    // ...
    Finished, Bindings generated in /var/folders/st/8cddrx857yj1gh8yvj0j499c0000gn/T/.tmpdIiHAo
    [2022-09-30T09:56:32Z DEBUG lib_flutter_rust_bridge_codegen::commands] command="sh" "-c" "\"flutter\" \"pub\" \"run\" \"ffigen\" \"--config\" \"/var/folders/st/8cddrx857yj1gh8yvj0j499c0000gn/T/.tmpCxnKBA\"" stdout= stderr=
    [2022-09-30T09:56:32Z INFO  lib_flutter_rust_bridge_codegen] Phase: Running build_runner
    [2022-09-30T09:56:32Z INFO  lib_flutter_rust_bridge_codegen] Phase: Formatting Dart code
    [2022-09-30T09:56:32Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute format_dart path=["/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.dart", "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_definitions.dart", "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.web.dart", "/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.io.dart"] line_length=120
    [2022-09-30T09:56:32Z DEBUG lib_flutter_rust_bridge_codegen::commands] execute command: bin=sh args="-c \"dart\" \"format\" \"--line-length\" \"120\" \"/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.dart\" \"/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_definitions.dart\" \"/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.web.dart\" \"/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.io.dart\"" current_dir=None cmd="sh" "-c" "\"dart\" \"format\" \"--line-length\" \"120\" \"/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.dart\" \"/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_definitions.dart\" \"/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.web.dart\" \"/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.io.dart\""
    Formatted /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.dart
    Formatted /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_definitions.dart
    Formatted /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.web.dart
    Formatted /Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.io.dart
    Formatted 4 files (4 changed) in 0.17 seconds.
    [2022-09-30T09:56:33Z DEBUG lib_flutter_rust_bridge_codegen::commands] command="sh" "-c" "\"dart\" \"format\" \"--line-length\" \"120\" \"/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.dart\" \"/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_definitions.dart\" \"/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.web.dart\" \"/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/lib/bridge_generated.io.dart\"" stdout= stderr=
    [2022-09-30T09:56:33Z INFO  lib_flutter_rust_bridge_codegen] Success!
    [2022-09-30T09:56:33Z INFO  flutter_rust_bridge_codegen] Now go and use it :)
    cd frb_example/pure_dart/rust && cargo clean -p flutter_rust_bridge_example_single_block_test && cargo build
       Compiling flutter_rust_bridge_example_single_block_test v1.0.0 (/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/pure_dart/rust)
        Finished dev [unoptimized + debuginfo] target(s) in 6.86s
    cd frb_example/pure_dart_multi/rust && cargo clean -p flutter_rust_bridge_example_multi_blocks_test && cargo build
       Compiling flutter_rust_bridge_codegen v1.48.0 (/Users/romain/Development/contributions/flutter_rust_bridge/frb_codegen)
       Compiling flutter_rust_bridge_example_multi_blocks_test v1.0.0 (/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/pure_dart_multi/rust)
        Finished dev [unoptimized + debuginfo] target(s) in 6.73s
    (cd frb_rust && cargo clippy -- -D warnings)
        Finished dev [unoptimized + debuginfo] target(s) in 0.14s
    (cd frb_macros && cargo clippy -- -D warnings)
        Finished dev [unoptimized + debuginfo] target(s) in 0.03s
    (cd frb_example/pure_dart/rust && cargo clippy -- -D warnings)
       Compiling flutter_rust_bridge_codegen v1.48.0 (/Users/romain/Development/contributions/flutter_rust_bridge/frb_codegen)
       Compiling flutter_rust_bridge_example_single_block_test v1.0.0 (/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/pure_dart/rust)
        Finished dev [unoptimized + debuginfo] target(s) in 8.00s
    (cd frb_example/pure_dart_multi/rust && cargo clippy -- -D warnings)
       Compiling flutter_rust_bridge_codegen v1.48.0 (/Users/romain/Development/contributions/flutter_rust_bridge/frb_codegen)
       Compiling flutter_rust_bridge_example_multi_blocks_test v1.0.0 (/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/pure_dart_multi/rust)
        Finished dev [unoptimized + debuginfo] target(s) in 6.97s
    (cd frb_example/with_flutter/rust && cargo clippy -- -D warnings)
        Checking flutter_rust_bridge_example v0.1.0 (/Users/romain/Development/contributions/flutter_rust_bridge/frb_example/with_flutter/rust)
        Finished dev [unoptimized + debuginfo] target(s) in 0.28s
    (cd frb_example/pure_dart/dart && dart pub get)
    Resolving dependencies... (1.8s)
      _fe_analyzer_shared 48.0.0 (49.0.0 available)
      analyzer 5.0.0 (5.1.0 available)
      frontend_server_client 2.1.3 (3.0.0 available)
    Got dependencies!
    (cd frb_example/pure_dart_multi/dart && dart pub get)
    Resolving dependencies... (1.6s)
      _fe_analyzer_shared 48.0.0 (49.0.0 available)
      analyzer 5.0.0 (5.1.0 available)
      coverage 1.0.3 (1.6.1 available)
      frontend_server_client 2.1.3 (3.0.0 available)
      vm_service 7.5.0 (9.4.0 available)
    Got dependencies!
    (cd frb_example/with_flutter && flutter pub get)
    Running "flutter pub get" in with_flutter...                     1,746ms
    just lint
    dart format --fix . 
    Formatted frb_example/pure_dart/dart/lib/bench.dart
    Formatted frb_example/pure_dart/dart/lib/bridge_definitions.dart
    Formatted frb_example/pure_dart/dart/lib/bridge_definitions.freezed.dart
    Formatted frb_example/pure_dart/dart/lib/bridge_generated.dart
    Formatted frb_example/pure_dart/dart/lib/bridge_generated.io.dart
    Formatted frb_example/pure_dart/dart/lib/bridge_generated.web.dart
    Formatted frb_example/pure_dart/dart/lib/ffi.io.dart
    Formatted frb_example/pure_dart/dart/lib/main.dart
    Formatted frb_example/pure_dart/dart/lib/utils.dart
    Formatted frb_example/pure_dart_multi/dart/lib/bridge_generated_api_1.dart
    Formatted frb_example/pure_dart_multi/dart/lib/bridge_generated_api_2.dart
    Formatted frb_example/with_flutter/integration_test/main.dart
    Formatted frb_example/with_flutter/lib/bridge_definitions.dart
    Formatted frb_example/with_flutter/lib/bridge_generated.dart
    Formatted frb_example/with_flutter/lib/bridge_generated.io.dart
    Formatted frb_example/with_flutter/lib/bridge_generated.web.dart
    Formatted frb_example/with_flutter/lib/main.dart
    Formatted frb_example/with_flutter/lib/off_topic_code.dart
    Formatted 45 files (18 changed) in 0.60 seconds.
    dart format --fix -l 120 frb_example/pure_dart 
    Formatted frb_example/pure_dart/dart/lib/bench.dart
    Formatted frb_example/pure_dart/dart/lib/bridge_definitions.dart
    Formatted frb_example/pure_dart/dart/lib/bridge_definitions.freezed.dart
    Formatted frb_example/pure_dart/dart/lib/bridge_generated.dart
    Formatted frb_example/pure_dart/dart/lib/bridge_generated.io.dart
    Formatted frb_example/pure_dart/dart/lib/bridge_generated.web.dart
    Formatted frb_example/pure_dart/dart/lib/ffi.io.dart
    Formatted frb_example/pure_dart/dart/lib/main.dart
    Formatted frb_example/pure_dart/dart/lib/utils.dart
    Formatted 13 files (9 changed) in 0.40 seconds.
    dart format --fix -l 120 frb_example/pure_dart_multi 
    Formatted frb_example/pure_dart_multi/dart/lib/bridge_generated_api_1.dart
    Formatted frb_example/pure_dart_multi/dart/lib/bridge_generated_api_2.dart
    Formatted 3 files (2 changed) in 0.14 seconds.
    dart format --fix -l 120 frb_example/with_flutter 
    Formatted frb_example/with_flutter/integration_test/main.dart
    Formatted frb_example/with_flutter/lib/bridge_definitions.dart
    Formatted frb_example/with_flutter/lib/bridge_generated.dart
    Formatted frb_example/with_flutter/lib/bridge_generated.io.dart
    Formatted frb_example/with_flutter/lib/bridge_generated.web.dart
    Formatted frb_example/with_flutter/lib/main.dart
    Formatted frb_example/with_flutter/lib/off_topic_code.dart
    Formatted 9 files (7 changed) in 0.21 seconds.
    cd frb_example/pure_dart/rust && cargo fmt
    cd frb_example/pure_dart_multi/rust && cargo fmt
    cd frb_example/with_flutter/rust && cargo fmt
    cd frb_codegen && cargo fmt
    sed -i "" -e 's/pub.flutter-io.cn/pub.dartlang.org/g' frb_example/pure_dart/dart/pubspec.lock
    sed -i "" -e 's/pub.flutter-io.cn/pub.dartlang.org/g' frb_example/pure_dart_multi/dart/pubspec.lock
    sed -i "" -e 's/pub.flutter-io.cn/pub.dartlang.org/g' frb_example/with_flutter/pubspec.lock
    

    To Reproduce

    Just build pure_dart example and run without web.

    Expected behavior

    No response

    Generated binding code

    click to display
    // AUTO GENERATED FILE, DO NOT EDIT.
    // Generated by `flutter_rust_bridge`@ 1.48.0.
    // ignore_for_file: non_constant_identifier_names, unused_element, duplicate_ignore, directives_ordering, curly_braces_in_flow_control_structures, unnecessary_lambdas, slash_for_doc_comments, prefer_const_literals_to_create_immutables, implicit_dynamic_list_literal, duplicate_import, unused_import, prefer_single_quotes, prefer_const_constructors, use_super_parameters, always_use_package_imports, annotate_overrides, invalid_use_of_protected_member, constant_identifier_names
    
    import "bridge_definitions.dart";
    import 'dart:convert';
    import 'dart:async';
    import 'package:flutter_rust_bridge/flutter_rust_bridge.dart';
    import 'package:uuid/uuid.dart';
    import 'bridge_generated.dart';
    export 'bridge_generated.dart';
    import 'dart:developer';
    import 'package:meta/meta.dart';
    import 'dart:ffi' as ffi;
    
    class FlutterRustBridgeExampleSingleBlockTestPlatform
        extends FlutterRustBridgeBase<FlutterRustBridgeExampleSingleBlockTestWire> {
      FlutterRustBridgeExampleSingleBlockTestPlatform(ffi.DynamicLibrary dylib)
          : super(FlutterRustBridgeExampleSingleBlockTestWire(dylib));
    // Section: api2wire
    
      @protected
      int api2wire_Chrono_Duration(Duration raw) {
        return api2wire_i64(raw.inMicroseconds);
      }
    
      @protected
      int api2wire_Chrono_Local(DateTime raw) {
        return api2wire_i64(raw.microsecondsSinceEpoch);
      }
    
      @protected
      int api2wire_Chrono_Naive(DateTime raw) {
        return api2wire_i64(raw.microsecondsSinceEpoch);
      }
    
      @protected
      int api2wire_Chrono_Utc(DateTime raw) {
        return api2wire_i64(raw.microsecondsSinceEpoch);
      }
    
      @protected
      ffi.Pointer<wire_uint_8_list> api2wire_String(String raw) {
        return api2wire_uint_8_list(utf8.encoder.convert(raw));
      }
    
      @protected
      ffi.Pointer<wire_StringList> api2wire_StringList(List<String> raw) {
        final ans = inner.new_StringList_0(raw.length);
        for (var i = 0; i < raw.length; i++) {
          ans.ref.ptr[i] = api2wire_String(raw[i]);
        }
        return ans;
      }
    
      @protected
      ffi.Pointer<wire_uint_8_list> api2wire_Uuid(UuidValue raw) {
        return api2wire_uint_8_list(raw.toBytes());
      }
    
      @protected
      ffi.Pointer<wire_uint_8_list> api2wire_Uuids(List<UuidValue> raw) {
        return api2wire_uint_8_list(api2wireConcatenateBytes(raw));
      }
    
      @protected
      ffi.Pointer<wire_uint_8_list> api2wire_ZeroCopyBuffer_Uint8List(Uint8List raw) {
        return api2wire_uint_8_list(raw);
      }
    
      // ...
    
    // ignore_for_file: camel_case_types, non_constant_identifier_names, avoid_positional_boolean_parameters, annotate_overrides, constant_identifier_names
    
    // AUTO GENERATED FILE, DO NOT EDIT.
    //
    // Generated by `package:ffigen`.
    
    /// generated by flutter_rust_bridge
    class FlutterRustBridgeExampleSingleBlockTestWire implements FlutterRustBridgeWireBase {
      /// Holds the symbol lookup function.
      final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName) _lookup;
    
      /// The symbols are looked up in [dynamicLibrary].
      FlutterRustBridgeExampleSingleBlockTestWire(ffi.DynamicLibrary dynamicLibrary) : _lookup = dynamicLibrary.lookup;
    
      /// The symbols are looked up with [lookup].
      FlutterRustBridgeExampleSingleBlockTestWire.fromLookup(
          ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName) lookup)
          : _lookup = lookup;
    
      void store_dart_post_cobject(
        DartPostCObjectFnType ptr,
      ) {
        return _store_dart_post_cobject(
          ptr,
        );
      }
    
      late final _store_dart_post_cobjectPtr =
          _lookup<ffi.NativeFunction<ffi.Void Function(DartPostCObjectFnType)>>('store_dart_post_cobject');
      late final _store_dart_post_cobject = _store_dart_post_cobjectPtr.asFunction<void Function(DartPostCObjectFnType)>();
    
      void wire_simple_adder(
        int port_,
        int a,
        int b,
      ) {
        return _wire_simple_adder(
          port_,
          a,
          b,
        );
      }
    
      late final _wire_simple_adderPtr =
          _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64, ffi.Int32, ffi.Int32)>>('wire_simple_adder');
      late final _wire_simple_adder = _wire_simple_adderPtr.asFunction<void Function(int, int, int)>();
    
      void wire_primitive_types(
        int port_,
        int my_i32,
        int my_i64,
        double my_f64,
        bool my_bool,
      ) {
        return _wire_primitive_types(
          port_,
          my_i32,
          my_i64,
          my_f64,
          my_bool,
        );
      }
    
      late final _wire_primitive_typesPtr =
          _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64, ffi.Int32, ffi.Int64, ffi.Double, ffi.Bool)>>(
              'wire_primitive_types');
      late final _wire_primitive_types = _wire_primitive_typesPtr.asFunction<void Function(int, int, int, double, bool)>();
    
      void wire_primitive_u32(
        int port_,
        int my_u32,
      ) {
        return _wire_primitive_u32(
          port_,
          my_u32,
        );
      }
    
      late final _wire_primitive_u32Ptr =
          _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64, ffi.Uint32)>>('wire_primitive_u32');
      late final _wire_primitive_u32 = _wire_primitive_u32Ptr.asFunction<void Function(int, int)>();
    
      void wire_handle_string(
        int port_,
        ffi.Pointer<wire_uint_8_list> s,
      ) {
        return _wire_handle_string(
          port_,
          s,
        );
      }
    
      late final _wire_handle_stringPtr =
          _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64, ffi.Pointer<wire_uint_8_list>)>>('wire_handle_string');
      late final _wire_handle_string =
          _wire_handle_stringPtr.asFunction<void Function(int, ffi.Pointer<wire_uint_8_list>)>();
    
      void wire_handle_return_unit(
        int port_,
      ) {
        return _wire_handle_return_unit(
          port_,
        );
      }
    
      late final _wire_handle_return_unitPtr =
          _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64)>>('wire_handle_return_unit');
      late final _wire_handle_return_unit = _wire_handle_return_unitPtr.asFunction<void Function(int)>();
    
      void wire_handle_vec_u8(
        int port_,
        ffi.Pointer<wire_uint_8_list> v,
      ) {
        return _wire_handle_vec_u8(
          port_,
          v,
        );
      }
    
      late final _wire_handle_vec_u8Ptr =
          _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64, ffi.Pointer<wire_uint_8_list>)>>('wire_handle_vec_u8');
      late final _wire_handle_vec_u8 =
          _wire_handle_vec_u8Ptr.asFunction<void Function(int, ffi.Pointer<wire_uint_8_list>)>();
    
      void wire_handle_vec_of_primitive(
        int port_,
        int n,
      ) {
        return _wire_handle_vec_of_primitive(
          port_,
          n,
        );
      }
    
      late final _wire_handle_vec_of_primitivePtr =
          _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64, ffi.Int32)>>('wire_handle_vec_of_primitive');
      late final _wire_handle_vec_of_primitive = _wire_handle_vec_of_primitivePtr.asFunction<void Function(int, int)>();
    
      void wire_handle_zero_copy_vec_of_primitive(
        int port_,
        int n,
      ) {
        return _wire_handle_zero_copy_vec_of_primitive(
          port_,
          n,
        );
      }
    
      late final _wire_handle_zero_copy_vec_of_primitivePtr =
          _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64, ffi.Int32)>>('wire_handle_zero_copy_vec_of_primitive');
      late final _wire_handle_zero_copy_vec_of_primitive =
          _wire_handle_zero_copy_vec_of_primitivePtr.asFunction<void Function(int, int)>();
    
      void wire_handle_struct(
        int port_,
        ffi.Pointer<wire_MySize> arg,
        ffi.Pointer<wire_MySize> boxed,
      ) {
        return _wire_handle_struct(
          port_,
          arg,
          boxed,
        );
      }
    
      late final _wire_handle_structPtr =
          _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64, ffi.Pointer<wire_MySize>, ffi.Pointer<wire_MySize>)>>(
              'wire_handle_struct');
      late final _wire_handle_struct =
          _wire_handle_structPtr.asFunction<void Function(int, ffi.Pointer<wire_MySize>, ffi.Pointer<wire_MySize>)>();
    
      void wire_handle_newtype(
        int port_,
        ffi.Pointer<wire_NewTypeInt> arg,
      ) {
        return _wire_handle_newtype(
          port_,
          arg,
        );
      }
    
      late final _wire_handle_newtypePtr =
          _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64, ffi.Pointer<wire_NewTypeInt>)>>('wire_handle_newtype');
      late final _wire_handle_newtype =
          _wire_handle_newtypePtr.asFunction<void Function(int, ffi.Pointer<wire_NewTypeInt>)>();
    
      void wire_handle_list_of_struct(
        int port_,
        ffi.Pointer<wire_list_my_size> l,
      ) {
        return _wire_handle_list_of_struct(
          port_,
          l,
        );
      }
    
      late final _wire_handle_list_of_structPtr =
          _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64, ffi.Pointer<wire_list_my_size>)>>(
              'wire_handle_list_of_struct');
      late final _wire_handle_list_of_struct =
          _wire_handle_list_of_structPtr.asFunction<void Function(int, ffi.Pointer<wire_list_my_size>)>();
    
      void wire_handle_string_list(
        int port_,
        ffi.Pointer<wire_StringList> names,
      ) {
        return _wire_handle_string_list(
          port_,
          names,
        );
      }
    
      late final _wire_handle_string_listPtr =
          _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64, ffi.Pointer<wire_StringList>)>>(
              'wire_handle_string_list');
      late final _wire_handle_string_list =
          _wire_handle_string_listPtr.asFunction<void Function(int, ffi.Pointer<wire_StringList>)>();
    
      void wire_handle_complex_struct(
        int port_,
        ffi.Pointer<wire_MyTreeNode> s,
      ) {
        return _wire_handle_complex_struct(
          port_,
          s,
        );
      }
    
      // ...
    
    typedef DartPostCObjectFnType = ffi.Pointer<ffi.NativeFunction<ffi.Bool Function(DartPort, ffi.Pointer<ffi.Void>)>>;
    typedef DartPort = ffi.Int64;
    typedef uintptr_t = ffi.UnsignedLong;
    

    OS

    MacOS M1 Pro Monterey 12.4

    Version of flutter_rust_bridge_codegen

    latest 1.48.0

    Flutter info

    [✓] Flutter (Channel stable, 3.3.3, on macOS 12.4 21F79 darwin-arm, locale en-TH)
        • Flutter version 3.3.3 on channel stable at /Users/romain/Development/sdk/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 18a827f393 (2 days ago), 2022-09-28 10:03:14 -0700
        • Engine revision 5c984c26eb
        • Dart version 2.18.2
        • DevTools version 2.15.0
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
        • Android SDK at /Users/romain/Library/Android/sdk
        • Platform android-33, build-tools 30.0.3
        • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
        • Xcode at /Applications/Xcode-beta.app/Contents/Developer
        • Build 13F100
        • CocoaPods version 1.11.2
    
    [✓] Android Studio (version 2020.3)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    
    [✓] VS Code (version 1.71.2)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.48.0
    
    [!] Connected device
        ! No devices available
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    

    Version of clang++

    Apple clang version 13.1.6 (clang-1316.0.21.2.5) Target: arm64-apple-darwin21.5.0

    Version of ffigen

    ^6.0.1

    Additional context

    No response

    bug 
    opened by Roms1383 36
  • workspace 1.64

    workspace 1.64

    Rust 1.64 is out and that could be the opportunity to make use of the workspace features ?

    Checklist

    • [ ] An issue to be fixed by this PR is listed above.
    • [ ] New tests are added to ensure new features are working. End-to-end tests are usually in the ./frb_example/pure_dart example, more specifically, rust/src/api.rs and dart/lib/main.dart.
    • [x] The code generator is run and the code is formatted (e.g. via just refresh_all).
    • [ ] If this PR adds/changes features, documentations (in the ./book folder) are updated.
    • [x] CI is passing.
    opened by Roms1383 35
  • [Bug] just gen generated using old flutter_rust_bridge version

    [Bug] just gen generated using old flutter_rust_bridge version

    Describe the bug

    I used to use flutter_rust_bridge version 1.49.0. Now I want to update it to the version flutter_rust_bridge: ^1.59.0. After upgrading with clean && pub get again, it always used version 1.49.0. Here my step:

    1. clone the template repo
    2. it could build an run normally
    3. pub clean && pub get and just clean && just gen
    4. it gave me those files:
    // AUTO GENERATED FILE, DO NOT EDIT.
    // Generated by `flutter_rust_bridge`@ 1.49.0.
    
    Screenshot 2022-12-30 at 12 14 31

    Any suggestion?

    Codegen logs with RUST_LOG=debug environment variable

    no issue with code gen
    

    To Reproduce

    No response

    Expected behavior

    No response

    Generated binding code

    No response

    OS

    No response

    Version of flutter_rust_bridge_codegen

    No response

    Flutter info

    No response

    Version of clang++

    No response

    Version of ffigen

    No response

    Additional context

    No response

    bug 
    opened by kingfisherphuoc 5
  • [Bug] Codegen wasm option creates files that flutter cannot run against

    [Bug] Codegen wasm option creates files that flutter cannot run against

    Describe the bug

    Codegen is really useful; so, surprised to see an option that's not just working well.

    Using the basic flutter_rust_bridge_template.

    This with wasm option included, completes ok but creates generated files that it seems flutter cannot run against:

    flutter_rust_bridge_codegen --rust-input ./native/src/api.rs --dart-output ./lib/bridge_generated.dart --wasm --dart-decl-output ./lib/bridge_generated.web.dart
    

    This works well for flutter to run but without that wasm option:

    flutter_rust_bridge_codegen --rust-input ./native/src/api.rs --dart-output ./lib/bridge_generated.dart
    

    flutter run error seems to centre on

    Error: 'NativePlatform' is imported from both 'package:flutter_rust_bridge_template/bridge_generated.web.dart' and 'package:flutter_rust_bridge_template/bridge_generated.io.dart'.
    import 'bridge_generated.io.dart'
    

    Full error from flutter against wasm generated Codegen outputs:

    $ flutter run
    Using hardware rendering with device sdk gphone64 x86 64. If you notice graphics artifacts, consider enabling software rendering with
    "--enable-software-rendering".
    Launching lib/main.dart on sdk gphone64 x86 64 in debug mode...
    lib/main.dart:54:15: Error: Type 'Platform' not found.
      late Future<Platform> platform;
                  ^^^^^^^^
    lib/main.dart:54:15: Error: 'Platform' isn't a type.
      late Future<Platform> platform;
                  ^^^^^^^^
    lib/main.dart:132:23: Error: 'Platform' isn't a type.
                    final Platform platform = data[0];
                          ^^^^^^^^
    lib/main.dart:135:23: Error: Undefined name 'Platform'.
                          Platform.Android: 'Android',
                          ^^^^^^^^
    lib/main.dart:136:23: Error: Undefined name 'Platform'.
                          Platform.Ios: 'iOS',
                          ^^^^^^^^
    lib/main.dart:137:23: Error: Undefined name 'Platform'.
                          Platform.MacApple: 'MacOS with Apple Silicon',
                          ^^^^^^^^
    lib/main.dart:138:23: Error: Undefined name 'Platform'.
                          Platform.MacIntel: 'MacOS',
                          ^^^^^^^^
    lib/main.dart:139:23: Error: Undefined name 'Platform'.
                          Platform.Windows: 'Windows',
                          ^^^^^^^^
    lib/main.dart:140:23: Error: Undefined name 'Platform'.
                          Platform.Unix: 'Unix',
                          ^^^^^^^^
    lib/main.dart:141:23: Error: Undefined name 'Platform'.
                          Platform.Wasm: 'the Web',
                          ^^^^^^^^
    lib/ffi.dart:20:7: Error: Type 'Native' not found.
    final Native api = NativeImpl(io.Platform.isIOS || io.Platform.isMacOS
          ^^^^^^
    lib/ffi.dart:20:7: Error: 'Native' isn't a type.
    final Native api = NativeImpl(io.Platform.isIOS || io.Platform.isMacOS
          ^^^^^^
    lib/bridge_generated.dart:14:29: Error: Type 'Native' not found.
    class NativeImpl implements Native {
                                ^^^^^^
    lib/bridge_generated.dart:88:10: Error: Type 'Platform' not found.
      Future<Platform> platform({dynamic hint}) {
             ^^^^^^^^
    lib/bridge_generated.dart:137:3: Error: Type 'Platform' not found.
      Platform _wire2api_platform(dynamic raw) {
      ^^^^^^^^
    lib/bridge_generated.dart:9:1: Error: 'NativePlatform' is imported from both 'package:flutter_rust_bridge_template/bridge_generated.web.dart' and 'package:flutter_rust_bridge_template/bridge_generated.io.dart'.
    import 'bridge_generated.io.dart'
    ^^^^^^^^^^^^^^
    lib/bridge_generated.dart:17:22: Error: 'NativePlatform' is imported from both 'package:flutter_rust_bridge_template/bridge_generated.web.dart' and 'package:flutter_rust_bridge_template/bridge_generated.io.dart'.
          NativeImpl.raw(NativePlatform(dylib));
                         ^^^^^^^^^^^^^^
    lib/bridge_generated.dart:138:12: Error: The getter 'Platform' isn't defined for the class 'NativeImpl'.
     - 'NativeImpl' is from 'package:flutter_rust_bridge_template/bridge_generated.dart' ('lib/bridge_generated.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'Platform'.
        return Platform.values[raw];
               ^^^^^^^^
    lib/bridge_generated.web.dart:52:26: Error: Type 'FlutterRustBridgeWasmWireBase' not found.
    class NativeWire extends FlutterRustBridgeWasmWireBase<NativeWasmModule> {
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    lib/bridge_generated.web.dart:28:2: Error: Couldn't find constructor 'JS'.
    @JS('wasm_bindgen')
     ^^
    lib/bridge_generated.web.dart:13:30: Error: Type argument 'NativeWire' doesn't conform to the bound 'FlutterRustBridgeWireBase' of the type variable 'T' on 'FlutterRustBridgeBase'.
     - 'NativeWire' is from 'package:flutter_rust_bridge_template/bridge_generated.web.dart' ('lib/bridge_generated.web.dart').
     - 'FlutterRustBridgeWireBase' is from 'package:flutter_rust_bridge/src/ffi/stub.dart' ('../../dev-tools/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_rust_bridge-1.57.0/lib/src/ffi/stub.dart').
    Try changing type arguments so that they conform to the bounds.
    class NativePlatform extends FlutterRustBridgeBase<NativeWire>
                                 ^
    lib/bridge_generated.web.dart:14:10: Error: Inferred type argument 'NativeWire' doesn't conform to the bound 'FlutterRustBridgeWireBase' of the type variable 'T' on 'FlutterRustBridgeSetupMixin'.
     - 'NativeWire' is from 'package:flutter_rust_bridge_template/bridge_generated.web.dart' ('lib/bridge_generated.web.dart').
     - 'FlutterRustBridgeWireBase' is from 'package:flutter_rust_bridge/src/ffi/stub.dart' ('../../dev-tools/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_rust_bridge-1.57.0/lib/src/ffi/stub.dart').
    Try specifying type arguments explicitly so that they conform to the bounds.
        with FlutterRustBridgeSetupMixin {
             ^
    lib/bridge_generated.web.dart:31:2: Error: Couldn't find constructor 'JS'.
    @JS()
     ^^
    lib/bridge_generated.web.dart:32:2: Error: Undefined name 'anonymous'.
    @anonymous
     ^^^^^^^^^
    lib/bridge_generated.web.dart:32:2: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor.
    @anonymous
     ^
    lib/bridge_generated.web.dart:18:33: Error: The getter 'init' isn't defined for the class 'NativeWire'.
     - 'NativeWire' is from 'package:flutter_rust_bridge_template/bridge_generated.web.dart' ('lib/bridge_generated.web.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'init'.
      Future<void> setup() => inner.init;
                                    ^^^^
    lib/bridge_generated.web.dart:54:14: Error: Too many positional arguments: 0 allowed, but 1 found.
    Try removing the extra positional arguments.
          : super(WasmModule.cast<NativeWasmModule>(module));
                 ^
    
    
    FAILURE: Build failed with an exception.
    
    * Where:
    Script '/mnt/vault/dev-tools/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1159
    
    * What went wrong:
    Execution failed for task ':app:compileFlutterBuildDebug'.
    > Process 'command '/mnt/vault/dev-tools/flutter/bin/flutter'' finished with non-zero exit value 1
    
    * Try:
    > Run with --stacktrace option to get the stack trace.
    > Run with --info or --debug option to get more log output.
    > Run with --scan to get full insights.
    
    * Get more help at https://help.gradle.org
    
    BUILD FAILED in 35s
    Running Gradle task 'assembleDebug'...                             37.7s
    Exception: Gradle task assembleDebug failed with exit code 1
    

    Codegen logs with RUST_LOG=debug environment variable

    Codegen completes with no errors.. but the output is evidently muddled for what flutter can make sense of.
    

    To Reproduce

    include the option --wasm --dart-decl-output ./lib/bridge_generated.web.dart flutter run in Android Studio generates error where without that option it works.

    Expected behavior

    wasm generated file bridge_generated.web should work well and flutter should not complain about 'NativePlatform' imported from both 'package:flutter_rust_bridge_template/bridge_generated.web.dart' and 'package:flutter_rust_bridge_template/bridge_generated.io.dart'.

    Generated binding code

    No response

    OS

    Linux

    Version of flutter_rust_bridge_codegen

    Generated by flutter_rust_bridge@ 1.58.2

    Flutter info

    $ flutter doctor -v
    [✓] Flutter (Channel stable, 3.3.10, on Linux Mint 21 5.15.0-56-generic, locale
        en_GB.UTF-8)
        • Flutter version 3.3.10 on channel stable at /mnt/vault/dev-tools/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 135454af32 (12 days ago), 2022-12-15 07:36:55 -0800
        • Engine revision 3316dd8728
        • Dart version 2.18.6
        • DevTools version 2.15.0
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
        • Android SDK at /mnt/vault/dev-tools/Android/Sdk
        • Platform android-33, build-tools 33.0.1
        • ANDROID_SDK_ROOT = /mnt/vault/dev-tools/Android/Sdk
        • Java binary at: /mnt/vault/dev-tools/Android/android-studio/jre/bin/java
        • Java version OpenJDK Runtime Environment (build
          11.0.13+0-b1751.21-8125866)
        • All Android licenses accepted.
    
    [✓] Chrome - develop for the web
        • CHROME_EXECUTABLE = /usr/bin/chromium
    
    [✓] Linux toolchain - develop for Linux desktop
        • Ubuntu clang version 14.0.0-1ubuntu1
        • cmake version 3.22.1
        • ninja version 1.10.1
        • pkg-config version 0.29.2
    
    [✓] Android Studio (version 2021.3)
        • Android Studio at /mnt/vault/dev-tools/Android/android-studio
        • Flutter plugin version 71.2.3
        • Dart plugin version 213.7433
        • Java version OpenJDK Runtime Environment (build
          11.0.13+0-b1751.21-8125866)
    
    [✓] VS Code (version 1.74.2)
        • VS Code at /usr/share/code
        • Flutter extension version 3.56.0
    
    [✓] Connected device (3 available)
        • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 12
          (API 31) (emulator)
        • Linux (desktop)              • linux         • linux-x64      • Linux Mint
          21 5.15.0-56-generic
        • Chrome (web)                 • chrome        • web-javascript • Chromium
          108.0.5359.124 for Linux Mint
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    • No issues found!
    

    Version of clang++

    No response

    Version of ffigen

    No response

    Additional context

    No response

    bug 
    opened by davidpbrown 2
  • Mutable methods

    Mutable methods

    Hi there,

    I created a struct with a method that needs to alter its inner state. However, when generating a binding, it says that mutable methods are unsupported because of safety reasons. Why is this? How can I get around this?

    Thanks

    opened by rhobro 12
  • More validation and error messages for paths in CLI

    More validation and error messages for paths in CLI

    Fixes #915

    This PR adds checks to the CLI argument parsing to ensure that

    • (manually provided) rust-input-file paths relative to working directory exist
    • (inferred or manually provided) rust-crate-dir paths relative to working directory exist
    • (inferred) paths to the rust manifest paths relative to working directory exist

    Also it changes some error messages to show more details (e.g. print the cause of "fail to guess class_name" error).

    In theory that might break some workflows (manual build.rs script?) where the rust input file is only created after these arguments are parsed but I'm not sure if this is something people do. Maybe this would need some input from other users/contributors/maintainers.

    Checklist

    • [X] An issue to be fixed by this PR is listed above.
    • [ ] New tests are added to ensure new features are working. End-to-end tests are usually in the ./frb_example/pure_dart example, more specifically, rust/src/api.rs and dart/lib/main.dart.
    • [ ] The code generator is run and the code is formatted (e.g. via just refresh_all).
    • [ ] If this PR adds/changes features, documentations (in the ./book folder) are updated.
    • [ ] CI is passing.
    opened by w1th0utnam3 0
  • More validation of input paths to codegen

    More validation of input paths to codegen

    Is your feature request related to a problem? Please describe. Running the codegen from a wrong directory or with invalid paths sometimes leads to confusing error messages. For example invoking codegen from the parent folder of the flutter example with an invalid path for the input file results in:

    flutter_rust_bridge/frb_example$ flutter_rust_bridge_codegen --rust-input rust/src/api.rs --dart-output=lib/bridge_generated.dart
    thread 'main' panicked at 'fail to guess class_name, please specify it manually in command line arguments', frb_codegen/src/config.rs:254:37
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    

    which is not very helpful for new users.

    Describe the solution you'd like The CLI should print an error message like "rust input file "..." does not exist" to make it clearer to the user that something is wrong with the paths.

    I will submit a PR for this that adds checks to the argument parsing that input files and other paths at least exist.

    Describe alternatives you've considered Alternatively, the entire configuration of the paths / working directories could be reworked. Ideally one would first start by clarifying & documenting which folders are supported as working directories, which input/output paths can be relative to what, which paths are needed and how they are inferred if not provided. From this one could rewrite the parsing of the arguments to clearly point out in an error case "this was given as input -> this was inferred -> this results in an invalid configuration". However I don't have the time to do this and I'm not sure how hard it is to do it properly when considering the external tools/libraries that are used by the codegen (as they have maybe their own assumptions and ways of treating paths).

    enhancement 
    opened by w1th0utnam3 1
Releases(v1.59.0)
A memory safe Lua interpreter

Hematita Da Lua Hematita Da Lua is an interpreter for the scripting language Lua, written entirely in 100% safe Rust. Hematita is the portugese word f

Daniel 149 Dec 29, 2022
Zero-cost high-level lua 5.3 wrapper for Rust

td_rlua This library is a high-level binding for Lua 5.3. You don't have access to the Lua stack, all you can do is read/write variables (including ca

null 47 May 4, 2022
High-level Rust bindings to Perl XS API

Perl XS for Rust High-level Rust bindings to Perl XS API. Example xs! { package Array::Sum; sub sum_array(ctx, array: AV) { array.iter().map(|

Vickenty Fesunov 59 Oct 6, 2022
Facilitating high-level interactions between Wasm modules and JavaScript

wasm-bindgen Facilitating high-level interactions between Wasm modules and JavaScript. Guide | API Docs | Contributing | Chat Built with ?? ?? by The

Rust and WebAssembly 5.9k Jan 8, 2023
Benchmark over Node.js binding frameworks in Rust

Benchmark over Node.js binding frameworks in Rust

LongYinan 7 Dec 28, 2022
Rust Attribute-Based Encryption library rabe's C FFI binding , support CP-ABE and KP-ABE encrypt and decrypt, submodule of Rabe.Core c# library.

Rabe-ffi Rust Attribute-Based Encryption library rabe's C FFI binding , support CP-ABE and KP-ABE encrypt and decrypt, submodule of Rabe.Core c# libra

Aya0wind 2 Oct 10, 2022
CO-RE binding generation for Rust, based on BTF

rust-struct-bindgen Here the repo of rust-struct-bindgen, a rust source code generator to read & write native structs with BTF. There are three crates

eunomia-bpf 3 Apr 21, 2023
lzma-rs binding to Node.js via napi-rs.

@napi-rs/lzma lzma-rs binding to Node.js via napi-rs. ?? Help me to become a full-time open-source developer by sponsoring me on Github Install yarn a

LongYinan 8 Aug 16, 2022
Whitewash is python binding for Ammonia.

Whitewash Whitewash is python binding for Ammonia. Ammonia is a whitelist-based HTML sanitization library. It is designed to prevent cross-site script

Vivek Kushwaha 1 Nov 23, 2021
Ypy - a Python binding for Y-CRDT

Ypy is a Python binding for Y-CRDT. It provides distributed data types that enable real-time collaboration between devices. Ypy can sync data with any other platform that has a Y-CRDT binding, allowing for seamless cross-domain communication. The library is a thin wrapper around Yrs, taking advantage of the safety and performance of Rust.

null 51 Dec 20, 2022
libnotcurses-sys is a low-level Rust wrapper for the notcurses C library

libnotcurses-sys is a low-level Rust wrapper for the notcurses C library This library is built with several layers of zero-overhead abstractions over

nick black 29 Nov 26, 2022
Tyrade: a pure functional language for type-level programming in Rust

A pure functional language for type-level programming in Rust

Will Crichton 286 Jan 1, 2023
The polyglot bindings generator for your library (C#, C, Python, …) 🐙

Interoptopus ?? The polyglot bindings generator for your library. Interoptopus allows you to deliver high-quality system libraries to your users, and

Ralf Biedert 155 Jan 3, 2023
Standalone python3.dll import library generator

Standalone python3.dll import library generator Generates import libraries for the Stable ABI Python DLL for MinGW-w64 and MSVC (cross-)compile target

PyO3 7 Oct 9, 2022
Low level tooling for WebAssembly in JavaScript using wasm-tools

js-wasm-tools js-wasm-tools compiles some of the API of wasm-tools to JavaScript and WebAssembly via wasm-bindgen. This offers low level tooling for W

Dominic Elm 59 Dec 19, 2022
Safe interop between Rust and C++

CXX — safe FFI between Rust and C++ This library provides a safe mechanism for calling C++ code from Rust and Rust code from C++, not subject to the m

David Tolnay 4.4k Jan 7, 2023
Safe Rust bridge for creating Erlang NIF functions

Rustler Documentation | Getting Started | Example Rustler is a library for writing Erlang NIFs in safe Rust code. That means there should be no ways t

Rusterlium 3.5k Jan 7, 2023
Safe Rust bindings to Lua 5.1

rust-lua Copyright 2014 Lily Ballard Description This is a set of Rust bindings to Lua 5.1. The goal is to provide a (relatively) safe interface to Lu

Lily Ballard 124 Jan 5, 2023
mruby safe bindings for Rust

mrusty. mruby safe bindings for Rust mrusty lets you: run Ruby 1.9 files with a very restricted API (without having to install Ruby) reflect Rust stru

Anima 200 Oct 12, 2022