Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The generated XXXWire.store_dart_post_cobject() has the wrong signature - caused by ffigen third-party library's fatal error 'stdarg.h' file not found #108

Closed
Michael-F-Bryan opened this issue Oct 21, 2021 · 32 comments
Labels
bug Something isn't working

Comments

@Michael-F-Bryan
Copy link
Contributor

Describe the bug

The generated store_dart_post_cobject() method has a method signature that differs from the abstract method on FlutterRustBridgeWireBase from version 1.2.0 of the flutter_rust_bridge Dart package.

To Reproduce

You should be able to reproduce this using my Michael-F-Bryan/native_add repository.

$ flutter --version
Flutter 2.5.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 18116933e7 (6 days ago) • 2021-10-15 10:46:35 -0700
Engine • revision d3ea636dc5
Tools • Dart 2.14.4

$ flutter_rust_bridge_codegen --version
flutter_rust_bridge_codegen 1.2.0

$ cd /tmp
$ git clone https://github.com/Michael-F-Bryan/native_add.git && cd native_add
$ git checkout 685ead26820b146ba78afe541c38d799234b1324

$ flutter_rust_bridge_codegen \
    --rust-input rust/src/api.rs \
    --dart-output lib/bridge_generated.dart \
    --c-output ios/Classes/bridge_generated.h

Now, trying to run the test (making sure add(2, 2) == "2 + 2 = 4") will fail with the following:

$ flutter test
00:00 +0: loading /home/consulting/Documents/native_add/test/native_add_test.dart                                                                             lib/bridge_generated.dart:132:9: Error: The parameter 'ptr' of the method 'NativeAddWire.store_dart_post_cobject' has type 'int', which does not match the
corresponding type, 'Pointer<NativeFunction<Uint8 Function(Int64, Pointer<Void>)>>', in the overridden method,
'FlutterRustBridgeWireBase.store_dart_post_cobject'.
 - 'Pointer' is from 'dart:ffi'.
 - 'NativeFunction' is from 'dart:ffi'.
 - 'Uint8' is from 'dart:ffi'.
 - 'Int64' is from 'dart:ffi'.
 - 'Void' is from 'dart:ffi'.
Change to a supertype of 'Pointer<NativeFunction<Uint8 Function(Int64, Pointer<Void>)>>', or, for a covariant parameter, a subtype.
    int ptr,
        ^
../../.pub-cache/hosted/pub.dartlang.org/flutter_rust_bridge-1.2.0/lib/src/basic.dart:111:8: Context: This is the overridden method
('store_dart_post_cobject').
  void store_dart_post_cobject(
       ^
00:04 +0 -1: loading /home/consulting/Documents/native_add/test/native_add_test.dart [E]
  Failed to load "/home/consulting/Documents/native_add/test/native_add_test.dart": Compilation failed for testPath=/home/consulting/Documents/native_add/test/native_add_test.dart
00:04 +0 -1: Some tests failed.

Expected behavior

The generated method should actually accept a ffi.Pointer<...> type and pass ptr.address to _store_dart_post_cobject().

diff --git a/lib/bridge_generated.dart b/lib/bridge_generated.dart
index 0b7c98d..1f821c0 100644
--- a/lib/bridge_generated.dart
+++ b/lib/bridge_generated.dart
@@ -129,10 +129,10 @@ class NativeAddWire implements FlutterRustBridgeWireBase {
       .asFunction<ffi.Pointer<wire_uint_8_list> Function(int)>();

   void store_dart_post_cobject(
-    int ptr,
+    ffi.Pointer<ffi.NativeFunction<ffi.Uint8 Function(ffi.Int64, ffi.Pointer<ffi.Void>)>> ptr,
   ) {
     return _store_dart_post_cobject(
-      ptr,
+      ptr.address,
     );
   }

Codegen logs

$ RUST_LOG=debug flutter_rust_bridge_codegen --rust-input rust/src/api.rs --dart-output lib/bridge_generated.dart --c-output ios/Classes/bridge_generated.h
[2021-10-21T20:16:09Z INFO  flutter_rust_bridge_codegen] Picked config: Opts { rust_input_path: "/home/consulting/Documents/native_add/rust/src/api.rs", dart_output_path: "/home/consulting/Documents/native_add/lib/bridge_generated.dart", c_output_path: "/home/consulting/Documents/native_add/ios/Classes/bridge_generated.h", rust_crate_dir: "/home/consulting/Documents/native_add/rust", rust_output_path: "/home/consulting/Documents/native_add/rust/src/bridge_generated.rs", class_name: "NativeAdd", dart_format_line_length: 80 }
[2021-10-21T20:16:09Z INFO  flutter_rust_bridge_codegen] Phase: Parse source code to AST
[2021-10-21T20:16:09Z INFO  flutter_rust_bridge_codegen] Phase: Parse AST to IR
[2021-10-21T20:16:09Z DEBUG flutter_rust_bridge_codegen::parser] parse_function function name: Ident(add)
[2021-10-21T20:16:09Z DEBUG flutter_rust_bridge_codegen::parser] parse_type: i32
[2021-10-21T20:16:09Z DEBUG flutter_rust_bridge_codegen::parser] parse_type: i32
[2021-10-21T20:16:09Z DEBUG flutter_rust_bridge_codegen::parser] parse_type: String
[2021-10-21T20:16:09Z DEBUG flutter_rust_bridge_codegen] parsed functions: ApiFile { funcs: [ApiFunc { name: "add", inputs: [ApiField { ty: Primitive(I32), name: ApiIdent { raw: "left" } }, ApiField { ty: Primitive(I32), name: ApiIdent { raw: "right" } }], output: Delegate(String), mode: Normal }], struct_pool: {}, has_executor: false }
[2021-10-21T20:16:09Z INFO  flutter_rust_bridge_codegen] Phase: Transform IR
[2021-10-21T20:16:09Z DEBUG flutter_rust_bridge_codegen] transformed functions: ApiFile { funcs: [ApiFunc { name: "add", inputs: [ApiField { ty: Primitive(I32), name: ApiIdent { raw: "left" } }, ApiField { ty: Primitive(I32), name: ApiIdent { raw: "right" } }], output: Delegate(String), mode: Normal }], struct_pool: {}, has_executor: false }
[2021-10-21T20:16:09Z INFO  flutter_rust_bridge_codegen] Phase: Generate Rust code
[2021-10-21T20:16:09Z INFO  flutter_rust_bridge_codegen] Phase: Generate Dart code
[2021-10-21T20:16:09Z DEBUG flutter_rust_bridge_codegen::generator_dart] distinct_types=[Primitive(I32), Delegate(String), PrimitiveList(ApiTypePrimitiveList { primitive: U8 }), Primitive(U8)]
[2021-10-21T20:16:09Z INFO  flutter_rust_bridge_codegen] Phase: Other things
[2021-10-21T20:16:09Z DEBUG flutter_rust_bridge_codegen::commands] execute format_rust path=/home/consulting/Documents/native_add/rust/src/bridge_generated.rs
[2021-10-21T20:16:09Z DEBUG flutter_rust_bridge_codegen::commands] execute command: "rustfmt" "/home/consulting/Documents/native_add/rust/src/bridge_generated.rs"
[2021-10-21T20:16:09Z DEBUG flutter_rust_bridge_codegen::commands] command="rustfmt" "/home/consulting/Documents/native_add/rust/src/bridge_generated.rs" output=Output { status: ExitStatus(unix_wait_status(0)), stdout: "", stderr: "[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] write_snippet `\n        // AUTO GENERATED FILE, DO NOT EDIT.\n// Generated by `flutter_rust_bridge`.\n\n        `\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] Normal: \"\\n        \"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] Comment: \"// AUTO GENERATED FILE, DO NOT EDIT.\\n// Generated by `flutter_rust_bridge`.\\n\"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] Normal: \"\\n        \"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] write_snippet `\n\n        // Section: wire functions\n\n        \n                `\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] Normal: \"\\n\\n        \"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] Comment: \"// Section: wire functions\\n\"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] Normal: \"\\n        \\n                \"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::items] compute_budgets_for_params 26 Indent { block_indent: 0, alignment: 0 }, 0, SameLine\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::items] rewrite_fn_base: one_line_budget: 70, multi_line_budget: 95, param_indent: Indent { block_indent: 4, alignment: 0 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] visit_block: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:12:79: 19:18\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:14:17: 17:20\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::chains] rewrite_chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(435), hi: BytePos(462), ctxt: #0 }, segments: [PathSegment { ident: FLUTTER_RUST_BRIDGE_HANDLER#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(435), hi: BytePos(462), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(435), hi: BytePos(462), ctxt: #0 } }, children: [ChainItem { kind: MethodCall(PathSegment { ident: wrap#0, id: NodeId(4294967040), args: None }, [], [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(435), hi: BytePos(462), ctxt: #0 }, segments: [PathSegment { ident: FLUTTER_RUST_BRIDGE_HANDLER#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(435), hi: BytePos(462), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Expr { id: NodeId(4294967040), kind: Struct(StructExpr { qself: None, path: Path { span: Span { lo: BytePos(468), hi: BytePos(476), ctxt: #0 }, segments: [PathSegment { ident: WrapInfo#0, id: NodeId(4294967040), args: None }], tokens: None }, fields: [ExprField { attrs: ThinVec(None), id: NodeId(4294967040), span: Span { lo: BytePos(478), hi: BytePos(495), ctxt: #0 }, ident: debug_name#0, expr: Expr { id: NodeId(4294967040), kind: Lit(Lit { token: Lit { kind: Str, symbol: \"add\", suffix: None }, kind: Str(\"add\", Cooked), span: Span { lo: BytePos(490), hi: BytePos(495), ctxt: #0 } }), span: Span { lo: BytePos(490), hi: BytePos(495), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, is_shorthand: false, is_placeholder: false }, ExprField { attrs: ThinVec(None), id: NodeId(4294967040), span: Span { lo: BytePos(497), hi: BytePos(501), ctxt: #0 }, ident: port#0, expr: Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(497), hi: BytePos(501), ctxt: #0 }, segments: [PathSegment { ident: port#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(497), hi: BytePos(501), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, is_shorthand: true, is_placeholder: false }, ExprField { attrs: ThinVec(None), id: NodeId(4294967040), span: Span { lo: BytePos(503), hi: BytePos(528), ctxt: #0 }, ident: mode#0, expr: Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(509), hi: BytePos(528), ctxt: #0 }, segments: [PathSegment { ident: FfiCallMode#0, id: NodeId(4294967040), args: None }, PathSegment { ident: Normal#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(509), hi: BytePos(528), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, is_shorthand: false, is_placeholder: false }], rest: None }), span: Span { lo: BytePos(468), hi: BytePos(530), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Expr { id: NodeId(4294967040), kind: Closure(Value, No, Movable, FnDecl { inputs: [], output: Default(Span { lo: BytePos(540), hi: BytePos(540), ctxt: #0 }) }, Expr { id: NodeId(4294967040), kind: Block(Block { stmts: [Stmt { id: NodeId(4294967040), kind: Local(Local { id: NodeId(4294967040), pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), api_left#0, None), span: Span { lo: BytePos(566), hi: BytePos(574), ctxt: #0 }, tokens: None }, ty: None, kind: Init(Expr { id: NodeId(4294967040), kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, segments: [PathSegment { ident: left#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, attrs: ThinVec(None), tokens: None }], Span { lo: BytePos(582), hi: BytePos(592), ctxt: #0 }), span: Span { lo: BytePos(577), hi: BytePos(592), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(562), hi: BytePos(593), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(562), hi: BytePos(593), ctxt: #0 } }, Stmt { id: NodeId(4294967040), kind: Local(Local { id: NodeId(4294967040), pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), api_right#0, None), span: Span { lo: BytePos(597), hi: BytePos(606), ctxt: #0 }, tokens: None }, ty: None, kind: Init(Expr { id: NodeId(4294967040), kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, segments: [PathSegment { ident: right#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, attrs: ThinVec(None), tokens: None }], Span { lo: BytePos(615), hi: BytePos(625), ctxt: #0 }), span: Span { lo: BytePos(609), hi: BytePos(625), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(593), hi: BytePos(626), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(593), hi: BytePos(626), ctxt: #0 } }, Stmt { id: NodeId(4294967040), kind: Expr(Expr { id: NodeId(4294967040), kind: Closure(Value, No, Movable, FnDecl { inputs: [Param { attrs: ThinVec(None), ty: Ty { id: NodeId(4294967040), kind: Infer, span: Span { lo: BytePos(653), hi: BytePos(666), ctxt: #0 }, tokens: None }, pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), task_callback#0, None), span: Span { lo: BytePos(653), hi: BytePos(666), ctxt: #0 }, tokens: None }, id: NodeId(4294967040), span: Span { lo: BytePos(653), hi: BytePos(667), ctxt: #0 }, is_placeholder: false }], output: Default(Span { lo: BytePos(668), hi: BytePos(668), ctxt: #0 }) }, Expr { id: NodeId(4294967040), kind: Call(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(668), hi: BytePos(671), ctxt: #0 }, segments: [PathSegment { ident: add#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(668), hi: BytePos(671), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(672), hi: BytePos(680), ctxt: #0 }, segments: [PathSegment { ident: api_left#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(672), hi: BytePos(680), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(682), hi: BytePos(691), ctxt: #0 }, segments: [PathSegment { ident: api_right#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(682), hi: BytePos(691), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), span: Span { lo: BytePos(668), hi: BytePos(692), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Span { lo: BytePos(647), hi: BytePos(667), ctxt: #0 }), span: Span { lo: BytePos(647), hi: BytePos(692), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(647), hi: BytePos(692), ctxt: #0 } }], id: NodeId(4294967040), rules: Default, span: Span { lo: BytePos(540), hi: BytePos(710), ctxt: #0 }, tokens: None, could_be_bare_literal: false }, None), span: Span { lo: BytePos(540), hi: BytePos(710), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Span { lo: BytePos(532), hi: BytePos(539), ctxt: #0 }), span: Span { lo: BytePos(532), hi: BytePos(710), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), tries: 0, span: Span { lo: BytePos(462), hi: BytePos(711), ctxt: #0 } }] } Shape { width: 95, indent: Indent { block_indent: 4, alignment: 0 }, offset: 0 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::chains] rewrite chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(435), hi: BytePos(462), ctxt: #0 }, segments: [PathSegment { ident: FLUTTER_RUST_BRIDGE_HANDLER#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(435), hi: BytePos(462), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(435), hi: BytePos(462), ctxt: #0 } }, children: [ChainItem { kind: MethodCall(PathSegment { ident: wrap#0, id: NodeId(4294967040), args: None }, [], [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(435), hi: BytePos(462), ctxt: #0 }, segments: [PathSegment { ident: FLUTTER_RUST_BRIDGE_HANDLER#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(435), hi: BytePos(462), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Expr { id: NodeId(4294967040), kind: Struct(StructExpr { qself: None, path: Path { span: Span { lo: BytePos(468), hi: BytePos(476), ctxt: #0 }, segments: [PathSegment { ident: WrapInfo#0, id: NodeId(4294967040), args: None }], tokens: None }, fields: [ExprField { attrs: ThinVec(None), id: NodeId(4294967040), span: Span { lo: BytePos(478), hi: BytePos(495), ctxt: #0 }, ident: debug_name#0, expr: Expr { id: NodeId(4294967040), kind: Lit(Lit { token: Lit { kind: Str, symbol: \"add\", suffix: None }, kind: Str(\"add\", Cooked), span: Span { lo: BytePos(490), hi: BytePos(495), ctxt: #0 } }), span: Span { lo: BytePos(490), hi: BytePos(495), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, is_shorthand: false, is_placeholder: false }, ExprField { attrs: ThinVec(None), id: NodeId(4294967040), span: Span { lo: BytePos(497), hi: BytePos(501), ctxt: #0 }, ident: port#0, expr: Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(497), hi: BytePos(501), ctxt: #0 }, segments: [PathSegment { ident: port#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(497), hi: BytePos(501), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, is_shorthand: true, is_placeholder: false }, ExprField { attrs: ThinVec(None), id: NodeId(4294967040), span: Span { lo: BytePos(503), hi: BytePos(528), ctxt: #0 }, ident: mode#0, expr: Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(509), hi: BytePos(528), ctxt: #0 }, segments: [PathSegment { ident: FfiCallMode#0, id: NodeId(4294967040), args: None }, PathSegment { ident: Normal#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(509), hi: BytePos(528), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, is_shorthand: false, is_placeholder: false }], rest: None }), span: Span { lo: BytePos(468), hi: BytePos(530), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Expr { id: NodeId(4294967040), kind: Closure(Value, No, Movable, FnDecl { inputs: [], output: Default(Span { lo: BytePos(540), hi: BytePos(540), ctxt: #0 }) }, Expr { id: NodeId(4294967040), kind: Block(Block { stmts: [Stmt { id: NodeId(4294967040), kind: Local(Local { id: NodeId(4294967040), pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), api_left#0, None), span: Span { lo: BytePos(566), hi: BytePos(574), ctxt: #0 }, tokens: None }, ty: None, kind: Init(Expr { id: NodeId(4294967040), kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, segments: [PathSegment { ident: left#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, attrs: ThinVec(None), tokens: None }], Span { lo: BytePos(582), hi: BytePos(592), ctxt: #0 }), span: Span { lo: BytePos(577), hi: BytePos(592), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(562), hi: BytePos(593), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(562), hi: BytePos(593), ctxt: #0 } }, Stmt { id: NodeId(4294967040), kind: Local(Local { id: NodeId(4294967040), pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), api_right#0, None), span: Span { lo: BytePos(597), hi: BytePos(606), ctxt: #0 }, tokens: None }, ty: None, kind: Init(Expr { id: NodeId(4294967040), kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, segments: [PathSegment { ident: right#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, attrs: ThinVec(None), tokens: None }], Span { lo: BytePos(615), hi: BytePos(625), ctxt: #0 }), span: Span { lo: BytePos(609), hi: BytePos(625), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(593), hi: BytePos(626), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(593), hi: BytePos(626), ctxt: #0 } }, Stmt { id: NodeId(4294967040), kind: Expr(Expr { id: NodeId(4294967040), kind: Closure(Value, No, Movable, FnDecl { inputs: [Param { attrs: ThinVec(None), ty: Ty { id: NodeId(4294967040), kind: Infer, span: Span { lo: BytePos(653), hi: BytePos(666), ctxt: #0 }, tokens: None }, pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), task_callback#0, None), span: Span { lo: BytePos(653), hi: BytePos(666), ctxt: #0 }, tokens: None }, id: NodeId(4294967040), span: Span { lo: BytePos(653), hi: BytePos(667), ctxt: #0 }, is_placeholder: false }], output: Default(Span { lo: BytePos(668), hi: BytePos(668), ctxt: #0 }) }, Expr { id: NodeId(4294967040), kind: Call(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(668), hi: BytePos(671), ctxt: #0 }, segments: [PathSegment { ident: add#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(668), hi: BytePos(671), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(672), hi: BytePos(680), ctxt: #0 }, segments: [PathSegment { ident: api_left#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(672), hi: BytePos(680), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(682), hi: BytePos(691), ctxt: #0 }, segments: [PathSegment { ident: api_right#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(682), hi: BytePos(691), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), span: Span { lo: BytePos(668), hi: BytePos(692), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Span { lo: BytePos(647), hi: BytePos(667), ctxt: #0 }), span: Span { lo: BytePos(647), hi: BytePos(692), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(647), hi: BytePos(692), ctxt: #0 } }], id: NodeId(4294967040), rules: Default, span: Span { lo: BytePos(540), hi: BytePos(710), ctxt: #0 }, tokens: None, could_be_bare_literal: false }, None), span: Span { lo: BytePos(540), hi: BytePos(710), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Span { lo: BytePos(532), hi: BytePos(539), ctxt: #0 }), span: Span { lo: BytePos(532), hi: BytePos(710), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), tries: 0, span: Span { lo: BytePos(462), hi: BytePos(711), ctxt: #0 } }] } Shape { width: 95, indent: Indent { block_indent: 4, alignment: 0 }, offset: 0 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::expr] rewrite_struct_lit: shape Shape { width: 91, indent: Indent { block_indent: 8, alignment: 0 }, offset: 0 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::comment] comment::changed_comment_content: false\norig: 'WrapInfo{ debug_name: \"add\", port, mode: FfiCallMode::Normal }'\nnew: 'WrapInfo {\n            debug_name: \"add\",\n            port,\n            mode: FfiCallMode::Normal,\n        }'\nraw_old: \nraw_new: \n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::closures] rewrite_closure Expr { id: NodeId(4294967040), kind: Block(Block { stmts: [Stmt { id: NodeId(4294967040), kind: Local(Local { id: NodeId(4294967040), pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), api_left#0, None), span: Span { lo: BytePos(566), hi: BytePos(574), ctxt: #0 }, tokens: None }, ty: None, kind: Init(Expr { id: NodeId(4294967040), kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, segments: [PathSegment { ident: left#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, attrs: ThinVec(None), tokens: None }], Span { lo: BytePos(582), hi: BytePos(592), ctxt: #0 }), span: Span { lo: BytePos(577), hi: BytePos(592), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(562), hi: BytePos(593), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(562), hi: BytePos(593), ctxt: #0 } }, Stmt { id: NodeId(4294967040), kind: Local(Local { id: NodeId(4294967040), pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), api_right#0, None), span: Span { lo: BytePos(597), hi: BytePos(606), ctxt: #0 }, tokens: None }, ty: None, kind: Init(Expr { id: NodeId(4294967040), kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, segments: [PathSegment { ident: right#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, attrs: ThinVec(None), tokens: None }], Span { lo: BytePos(615), hi: BytePos(625), ctxt: #0 }), span: Span { lo: BytePos(609), hi: BytePos(625), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(593), hi: BytePos(626), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(593), hi: BytePos(626), ctxt: #0 } }, Stmt { id: NodeId(4294967040), kind: Expr(Expr { id: NodeId(4294967040), kind: Closure(Value, No, Movable, FnDecl { inputs: [Param { attrs: ThinVec(None), ty: Ty { id: NodeId(4294967040), kind: Infer, span: Span { lo: BytePos(653), hi: BytePos(666), ctxt: #0 }, tokens: None }, pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), task_callback#0, None), span: Span { lo: BytePos(653), hi: BytePos(666), ctxt: #0 }, tokens: None }, id: NodeId(4294967040), span: Span { lo: BytePos(653), hi: BytePos(667), ctxt: #0 }, is_placeholder: false }], output: Default(Span { lo: BytePos(668), hi: BytePos(668), ctxt: #0 }) }, Expr { id: NodeId(4294967040), kind: Call(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(668), hi: BytePos(671), ctxt: #0 }, segments: [PathSegment { ident: add#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(668), hi: BytePos(671), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(672), hi: BytePos(680), ctxt: #0 }, segments: [PathSegment { ident: api_left#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(672), hi: BytePos(680), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(682), hi: BytePos(691), ctxt: #0 }, segments: [PathSegment { ident: api_right#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(682), hi: BytePos(691), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), span: Span { lo: BytePos(668), hi: BytePos(692), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Span { lo: BytePos(647), hi: BytePos(667), ctxt: #0 }), span: Span { lo: BytePos(647), hi: BytePos(692), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(647), hi: BytePos(692), ctxt: #0 } }], id: NodeId(4294967040), rules: Default, span: Span { lo: BytePos(540), hi: BytePos(710), ctxt: #0 }, tokens: None, could_be_bare_literal: false }, None), span: Span { lo: BytePos(540), hi: BytePos(710), ctxt: #0 }, attrs: ThinVec(None), tokens: None }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] visit_block: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:14:122: 17:18\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:15:21: 15:52\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::items] Local::rewrite Local { id: NodeId(4294967040), pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), api_left#0, None), span: Span { lo: BytePos(566), hi: BytePos(574), ctxt: #0 }, tokens: None }, ty: None, kind: Init(Expr { id: NodeId(4294967040), kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, segments: [PathSegment { ident: left#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, attrs: ThinVec(None), tokens: None }], Span { lo: BytePos(582), hi: BytePos(592), ctxt: #0 }), span: Span { lo: BytePos(577), hi: BytePos(592), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(562), hi: BytePos(593), ctxt: #0 }, attrs: ThinVec(None), tokens: None } 88 Indent { block_indent: 12, alignment: 0 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::chains] rewrite_chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, segments: [PathSegment { ident: left#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 } }, children: [ChainItem { kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [], [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, segments: [PathSegment { ident: left#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), tries: 0, span: Span { lo: BytePos(581), hi: BytePos(592), ctxt: #0 } }] } Shape { width: 72, indent: Indent { block_indent: 12, alignment: 0 }, offset: 15 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::chains] rewrite chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, segments: [PathSegment { ident: left#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 } }, children: [ChainItem { kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [], [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, segments: [PathSegment { ident: left#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), tries: 0, span: Span { lo: BytePos(581), hi: BytePos(592), ctxt: #0 } }] } Shape { width: 72, indent: Indent { block_indent: 12, alignment: 0 }, offset: 15 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:15:52: 15:85\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::items] Local::rewrite Local { id: NodeId(4294967040), pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), api_right#0, None), span: Span { lo: BytePos(597), hi: BytePos(606), ctxt: #0 }, tokens: None }, ty: None, kind: Init(Expr { id: NodeId(4294967040), kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, segments: [PathSegment { ident: right#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, attrs: ThinVec(None), tokens: None }], Span { lo: BytePos(615), hi: BytePos(625), ctxt: #0 }), span: Span { lo: BytePos(609), hi: BytePos(625), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(593), hi: BytePos(626), ctxt: #0 }, attrs: ThinVec(None), tokens: None } 88 Indent { block_indent: 12, alignment: 0 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::chains] rewrite_chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, segments: [PathSegment { ident: right#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 } }, children: [ChainItem { kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [], [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, segments: [PathSegment { ident: right#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), tries: 0, span: Span { lo: BytePos(614), hi: BytePos(625), ctxt: #0 } }] } Shape { width: 71, indent: Indent { block_indent: 12, alignment: 0 }, offset: 16 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::chains] rewrite chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, segments: [PathSegment { ident: right#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 } }, children: [ChainItem { kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [], [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, segments: [PathSegment { ident: right#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), tries: 0, span: Span { lo: BytePos(614), hi: BytePos(625), ctxt: #0 } }] } Shape { width: 71, indent: Indent { block_indent: 12, alignment: 0 }, offset: 16 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:16:21: 16:66\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::closures] rewrite_closure Expr { id: NodeId(4294967040), kind: Call(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(668), hi: BytePos(671), ctxt: #0 }, segments: [PathSegment { ident: add#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(668), hi: BytePos(671), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(672), hi: BytePos(680), ctxt: #0 }, segments: [PathSegment { ident: api_left#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(672), hi: BytePos(680), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(682), hi: BytePos(691), ctxt: #0 }, segments: [PathSegment { ident: api_right#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(682), hi: BytePos(691), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), span: Span { lo: BytePos(668), hi: BytePos(692), ctxt: #0 }, attrs: ThinVec(None), tokens: None }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] close_block: Normal 0 \"\\n                \"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::comment] comment::changed_comment_content: false\norig: '{\n                    let api_left = left.wire2api();let api_right = right.wire2api();\n                    move |task_callback| add(api_left, api_right)\n                }'\nnew: '{\n            let api_left = left.wire2api();\n            let api_right = right.wire2api();\n            move |task_callback| add(api_left, api_right)\n        }'\nraw_old: \nraw_new: \n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::comment] comment::changed_comment_content: false\norig: 'move || {\n                    let api_left = left.wire2api();let api_right = right.wire2api();\n                    move |task_callback| add(api_left, api_right)\n                }'\nnew: 'move || {\n            let api_left = left.wire2api();\n            let api_right = right.wire2api();\n            move |task_callback| add(api_left, api_right)\n        }'\nraw_old: \nraw_new: \n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::comment] comment::changed_comment_content: false\norig: 'FLUTTER_RUST_BRIDGE_HANDLER.wrap(WrapInfo{ debug_name: \"add\", port, mode: FfiCallMode::Normal }, move || {\n                    let api_left = left.wire2api();let api_right = right.wire2api();\n                    move |task_callback| add(api_left, api_right)\n                })'\nnew: 'FLUTTER_RUST_BRIDGE_HANDLER.wrap(\n        WrapInfo {\n            debug_name: \"add\",\n            port,\n            mode: FfiCallMode::Normal,\n        },\n        move || {\n            let api_left = left.wire2api();\n            let api_right = right.wire2api();\n            move |task_callback| add(api_left, api_right)\n        },\n    )'\nraw_old: \nraw_new: \n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::comment] comment::changed_comment_content: false\norig: 'FLUTTER_RUST_BRIDGE_HANDLER.wrap(WrapInfo{ debug_name: \"add\", port, mode: FfiCallMode::Normal }, move || {\n                    let api_left = left.wire2api();let api_right = right.wire2api();\n                    move |task_callback| add(api_left, api_right)\n                });'\nnew: 'FLUTTER_RUST_BRIDGE_HANDLER.wrap(\n        WrapInfo {\n            debug_name: \"add\",\n            port,\n            mode: FfiCallMode::Normal,\n        },\n        move || {\n            let api_left = left.wire2api();\n            let api_right = right.wire2api();\n            move |task_callback| add(api_left, api_right)\n        },\n    );'\nraw_old: \nraw_new: \n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] close_block: Normal 0 \"\\n                \\n                \"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::attr] item_str: 'Clone,'\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] write_snippet `\n            \n\n        // Section: wire structs\n\n        \n\n\n\n\n        `\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] Normal: \"\\n            \\n\\n        \"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] Comment: \"// Section: wire structs\\n\"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] Normal: \"\\n        \\n\\n\\n\\n\\n        \"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] write_snippet `\n        \n\n\n\n        // Section: allocate functions\n\n        \n\n\n\n\n                `\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] Normal: \"\\n        \\n\\n\\n\\n        \"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] Comment: \"// Section: allocate functions\\n\"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] Normal: \"\\n        \\n\\n\\n\\n\\n                \"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::items] compute_budgets_for_params 33 Indent { block_indent: 0, alignment: 0 }, 24, SameLine\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::items] rewrite_fn_base: one_line_budget: 38, multi_line_budget: 95, param_indent: Indent { block_indent: 4, alignment: 0 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] visit_block: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:47:86: 50:18\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:48:21: 48:113\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::items] Local::rewrite Local { id: NodeId(4294967040), pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), ans#0, None), span: Span { lo: BytePos(1141), hi: BytePos(1144), ctxt: #0 }, tokens: None }, ty: None, kind: Init(Expr { id: NodeId(4294967040), kind: Struct(StructExpr { qself: None, path: Path { span: Span { lo: BytePos(1147), hi: BytePos(1163), ctxt: #0 }, segments: [PathSegment { ident: wire_uint_8_list#0, id: NodeId(4294967040), args: None }], tokens: None }, fields: [ExprField { attrs: ThinVec(None), id: NodeId(4294967040), span: Span { lo: BytePos(1166), hi: BytePos(1221), ctxt: #0 }, ident: ptr#0, expr: Expr { id: NodeId(4294967040), kind: Call(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1171), hi: BytePos(1196), ctxt: #0 }, segments: [PathSegment { ident: support#0, id: NodeId(4294967040), args: None }, PathSegment { ident: new_leak_vec_ptr#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1171), hi: BytePos(1196), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, [Expr { id: NodeId(4294967040), kind: Call(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1197), hi: BytePos(1213), ctxt: #0 }, segments: [PathSegment { ident: Default#0, id: NodeId(4294967040), args: None }, PathSegment { ident: default#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1197), hi: BytePos(1213), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, []), span: Span { lo: BytePos(1197), hi: BytePos(1215), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1217), hi: BytePos(1220), ctxt: #0 }, segments: [PathSegment { ident: len#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1217), hi: BytePos(1220), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), span: Span { lo: BytePos(1171), hi: BytePos(1221), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, is_shorthand: false, is_placeholder: false }, ExprField { attrs: ThinVec(None), id: NodeId(4294967040), span: Span { lo: BytePos(1223), hi: BytePos(1226), ctxt: #0 }, ident: len#0, expr: Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1223), hi: BytePos(1226), ctxt: #0 }, segments: [PathSegment { ident: len#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1223), hi: BytePos(1226), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, is_shorthand: true, is_placeholder: false }], rest: None }), span: Span { lo: BytePos(1147), hi: BytePos(1228), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(1137), hi: BytePos(1229), ctxt: #0 }, attrs: ThinVec(None), tokens: None } 96 Indent { block_indent: 4, alignment: 0 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::expr] rewrite_struct_lit: shape Shape { width: 85, indent: Indent { block_indent: 4, alignment: 0 }, offset: 10 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::comment] comment::changed_comment_content: false\norig: 'wire_uint_8_list { ptr: support::new_leak_vec_ptr(Default::default(), len), len }'\nnew: 'wire_uint_8_list {\n        ptr: support::new_leak_vec_ptr(Default::default(), len),\n        len,\n    }'\nraw_old: \nraw_new: \n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::expr] rewrite_struct_lit: shape Shape { width: 91, indent: Indent { block_indent: 8, alignment: 0 }, offset: 0 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::comment] comment::changed_comment_content: false\norig: 'wire_uint_8_list { ptr: support::new_leak_vec_ptr(Default::default(), len), len }'\nnew: 'wire_uint_8_list {\n            ptr: support::new_leak_vec_ptr(Default::default(), len),\n            len,\n        }'\nraw_old: \nraw_new: \n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::comment] comment::changed_comment_content: false\norig: 'let ans = wire_uint_8_list { ptr: support::new_leak_vec_ptr(Default::default(), len), len };'\nnew: 'let ans = wire_uint_8_list {\n        ptr: support::new_leak_vec_ptr(Default::default(), len),\n        len,\n    };'\nraw_old: \nraw_new: \n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:49:17: 49:47\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] close_block: Normal 0 \"\\n                \"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::items] compute_budgets_for_params 11 Indent { block_indent: 4, alignment: 0 }, 4, None\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::items] rewrite_fn_base: one_line_budget: 77, multi_line_budget: 91, param_indent: Indent { block_indent: 8, alignment: 0 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] write_snippet `\n            \n\n\n\n        // Section: impl Wire2Api\n\n        `\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] Normal: \"\\n            \\n\\n\\n\\n        \"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] Comment: \"// Section: impl Wire2Api\\n\"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] Normal: \"\\n        \"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::items] compute_budgets_for_params 11 Indent { block_indent: 4, alignment: 0 }, 6, SameLine\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::items] rewrite_fn_base: one_line_budget: 74, multi_line_budget: 91, param_indent: Indent { block_indent: 8, alignment: 0 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] visit_block: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:62:38: 64:14\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:63:17: 63:21\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] close_block: Normal 0 \"\\n            \"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::items] compute_budgets_for_params 11 Indent { block_indent: 4, alignment: 0 }, 9, SameLine\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::items] rewrite_fn_base: one_line_budget: 71, multi_line_budget: 91, param_indent: Indent { block_indent: 8, alignment: 0 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] visit_block: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:69:41: 72:14\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:70:17: 70:52\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::items] Local::rewrite Local { id: NodeId(4294967040), pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), vec#0, None), span: Span { lo: BytePos(1668), hi: BytePos(1671), ctxt: #0 }, tokens: None }, ty: Some(Ty { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1673), hi: BytePos(1680), ctxt: #0 }, segments: [PathSegment { ident: Vec#0, id: NodeId(4294967040), args: Some(AngleBracketed(AngleBracketedArgs { span: Span { lo: BytePos(1676), hi: BytePos(1680), ctxt: #0 }, args: [Arg(Type(Ty { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1677), hi: BytePos(1679), ctxt: #0 }, segments: [PathSegment { ident: u8#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1677), hi: BytePos(1679), ctxt: #0 }, tokens: None }))] })) }], tokens: None }), span: Span { lo: BytePos(1673), hi: BytePos(1680), ctxt: #0 }, tokens: None }), kind: Init(Expr { id: NodeId(4294967040), kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1683), hi: BytePos(1687), ctxt: #0 }, segments: [PathSegment { ident: self#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1683), hi: BytePos(1687), ctxt: #0 }, attrs: ThinVec(None), tokens: None }], Span { lo: BytePos(1688), hi: BytePos(1698), ctxt: #0 }), span: Span { lo: BytePos(1683), hi: BytePos(1698), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(1664), hi: BytePos(1699), ctxt: #0 }, attrs: ThinVec(None), tokens: None } 92 Indent { block_indent: 8, alignment: 0 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::chains] rewrite_chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1683), hi: BytePos(1687), ctxt: #0 }, segments: [PathSegment { ident: self#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1683), hi: BytePos(1687), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(1683), hi: BytePos(1687), ctxt: #0 } }, children: [ChainItem { kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [], [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1683), hi: BytePos(1687), ctxt: #0 }, segments: [PathSegment { ident: self#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1683), hi: BytePos(1687), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), tries: 0, span: Span { lo: BytePos(1687), hi: BytePos(1698), ctxt: #0 } }] } Shape { width: 72, indent: Indent { block_indent: 8, alignment: 0 }, offset: 19 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::chains] rewrite chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1683), hi: BytePos(1687), ctxt: #0 }, segments: [PathSegment { ident: self#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1683), hi: BytePos(1687), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(1683), hi: BytePos(1687), ctxt: #0 } }, children: [ChainItem { kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [], [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1683), hi: BytePos(1687), ctxt: #0 }, segments: [PathSegment { ident: self#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1683), hi: BytePos(1687), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), tries: 0, span: Span { lo: BytePos(1687), hi: BytePos(1698), ctxt: #0 } }] } Shape { width: 72, indent: Indent { block_indent: 8, alignment: 0 }, offset: 19 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:71:17: 71:59\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::chains] rewrite_chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Call(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1716), hi: BytePos(1739), ctxt: #0 }, segments: [PathSegment { ident: String#0, id: NodeId(4294967040), args: None }, PathSegment { ident: from_utf8_lossy#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1716), hi: BytePos(1739), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, [Expr { id: NodeId(4294967040), kind: AddrOf(Ref, Not, Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1741), hi: BytePos(1744), ctxt: #0 }, segments: [PathSegment { ident: vec#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1741), hi: BytePos(1744), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(1740), hi: BytePos(1744), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), span: Span { lo: BytePos(1716), hi: BytePos(1745), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(1716), hi: BytePos(1745), ctxt: #0 } }, children: [ChainItem { kind: MethodCall(PathSegment { ident: into_owned#0, id: NodeId(4294967040), args: None }, [], [Expr { id: NodeId(4294967040), kind: Call(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1716), hi: BytePos(1739), ctxt: #0 }, segments: [PathSegment { ident: String#0, id: NodeId(4294967040), args: None }, PathSegment { ident: from_utf8_lossy#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1716), hi: BytePos(1739), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, [Expr { id: NodeId(4294967040), kind: AddrOf(Ref, Not, Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1741), hi: BytePos(1744), ctxt: #0 }, segments: [PathSegment { ident: vec#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1741), hi: BytePos(1744), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(1740), hi: BytePos(1744), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), span: Span { lo: BytePos(1716), hi: BytePos(1745), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), tries: 0, span: Span { lo: BytePos(1745), hi: BytePos(1758), ctxt: #0 } }] } Shape { width: 92, indent: Indent { block_indent: 8, alignment: 0 }, offset: 0 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::chains] rewrite chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Call(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1716), hi: BytePos(1739), ctxt: #0 }, segments: [PathSegment { ident: String#0, id: NodeId(4294967040), args: None }, PathSegment { ident: from_utf8_lossy#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1716), hi: BytePos(1739), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, [Expr { id: NodeId(4294967040), kind: AddrOf(Ref, Not, Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1741), hi: BytePos(1744), ctxt: #0 }, segments: [PathSegment { ident: vec#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1741), hi: BytePos(1744), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(1740), hi: BytePos(1744), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), span: Span { lo: BytePos(1716), hi: BytePos(1745), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(1716), hi: BytePos(1745), ctxt: #0 } }, children: [ChainItem { kind: MethodCall(PathSegment { ident: into_owned#0, id: NodeId(4294967040), args: None }, [], [Expr { id: NodeId(4294967040), kind: Call(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1716), hi: BytePos(1739), ctxt: #0 }, segments: [PathSegment { ident: String#0, id: NodeId(4294967040), args: None }, PathSegment { ident: from_utf8_lossy#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1716), hi: BytePos(1739), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, [Expr { id: NodeId(4294967040), kind: AddrOf(Ref, Not, Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1741), hi: BytePos(1744), ctxt: #0 }, segments: [PathSegment { ident: vec#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1741), hi: BytePos(1744), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(1740), hi: BytePos(1744), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), span: Span { lo: BytePos(1716), hi: BytePos(1745), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), tries: 0, span: Span { lo: BytePos(1745), hi: BytePos(1758), ctxt: #0 } }] } Shape { width: 92, indent: Indent { block_indent: 8, alignment: 0 }, offset: 0 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] close_block: Normal 0 \"\\n            \"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::items] compute_budgets_for_params 11 Indent { block_indent: 4, alignment: 0 }, 10, SameLine\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::items] rewrite_fn_base: one_line_budget: 70, multi_line_budget: 91, param_indent: Indent { block_indent: 8, alignment: 0 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] visit_block: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:77:42: 82:14\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:78:17: 81:14\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] visit_block: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:78:17: 81:14\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:79:17: 79:61\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::items] Local::rewrite Local { id: NodeId(4294967040), pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), wrap#0, None), span: Span { lo: BytePos(1932), hi: BytePos(1936), ctxt: #0 }, tokens: None }, ty: None, kind: Init(Expr { id: NodeId(4294967040), kind: Call(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1939), hi: BytePos(1965), ctxt: #0 }, segments: [PathSegment { ident: support#0, id: NodeId(4294967040), args: None }, PathSegment { ident: box_from_leak_ptr#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1939), hi: BytePos(1965), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1966), hi: BytePos(1970), ctxt: #0 }, segments: [PathSegment { ident: self#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1966), hi: BytePos(1970), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), span: Span { lo: BytePos(1939), hi: BytePos(1971), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(1928), hi: BytePos(1972), ctxt: #0 }, attrs: ThinVec(None), tokens: None } 88 Indent { block_indent: 12, alignment: 0 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:80:17: 80:63\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::chains] rewrite_chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(2016), hi: BytePos(2020), ctxt: #0 }, segments: [PathSegment { ident: wrap#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(2016), hi: BytePos(2020), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(2016), hi: BytePos(2020), ctxt: #0 } }, children: [ChainItem { kind: StructField(ptr#0), tries: 0, span: Span { lo: BytePos(2020), hi: BytePos(2024), ctxt: #0 } }] } Shape { width: 83, indent: Indent { block_indent: 16, alignment: 0 }, offset: 0 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::chains] rewrite chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(2016), hi: BytePos(2020), ctxt: #0 }, segments: [PathSegment { ident: wrap#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(2016), hi: BytePos(2020), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(2016), hi: BytePos(2020), ctxt: #0 } }, children: [ChainItem { kind: StructField(ptr#0), tries: 0, span: Span { lo: BytePos(2020), hi: BytePos(2024), ctxt: #0 } }] } Shape { width: 83, indent: Indent { block_indent: 16, alignment: 0 }, offset: 0 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::chains] rewrite_chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(2026), hi: BytePos(2030), ctxt: #0 }, segments: [PathSegment { ident: wrap#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(2026), hi: BytePos(2030), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(2026), hi: BytePos(2030), ctxt: #0 } }, children: [ChainItem { kind: StructField(len#0), tries: 0, span: Span { lo: BytePos(2030), hi: BytePos(2034), ctxt: #0 } }] } Shape { width: 83, indent: Indent { block_indent: 16, alignment: 0 }, offset: 0 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::chains] rewrite chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(2026), hi: BytePos(2030), ctxt: #0 }, segments: [PathSegment { ident: wrap#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(2026), hi: BytePos(2030), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(2026), hi: BytePos(2030), ctxt: #0 } }, children: [ChainItem { kind: StructField(len#0), tries: 0, span: Span { lo: BytePos(2030), hi: BytePos(2034), ctxt: #0 } }] } Shape { width: 83, indent: Indent { block_indent: 16, alignment: 0 }, offset: 0 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] close_block: Normal 0 \"\\n            \"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::comment] comment::changed_comment_content: false\norig: 'unsafe {\n                let wrap = support::box_from_leak_ptr(self);\n                support::vec_from_leak_ptr(wrap.ptr, wrap.len)\n            }'\nnew: 'unsafe {\n            let wrap = support::box_from_leak_ptr(self);\n            support::vec_from_leak_ptr(wrap.ptr, wrap.len)\n        }'\nraw_old: \nraw_new: \n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::comment] comment::changed_comment_content: false\norig: 'unsafe {\n                let wrap = support::box_from_leak_ptr(self);\n                support::vec_from_leak_ptr(wrap.ptr, wrap.len)\n            }'\nnew: 'unsafe {\n            let wrap = support::box_from_leak_ptr(self);\n            support::vec_from_leak_ptr(wrap.ptr, wrap.len)\n        }'\nraw_old: \nraw_new: \n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] close_block: Normal 0 \"\\n            \"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::items] compute_budgets_for_params 11 Indent { block_indent: 4, alignment: 0 }, 5, SameLine\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::items] rewrite_fn_base: one_line_budget: 75, multi_line_budget: 91, param_indent: Indent { block_indent: 8, alignment: 0 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] visit_block: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:87:37: 89:14\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:88:17: 88:21\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] close_block: Normal 0 \"\\n            \"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::items] compute_budgets_for_params 20 Indent { block_indent: 4, alignment: 0 }, 7, None\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::items] rewrite_fn_base: one_line_budget: 65, multi_line_budget: 91, param_indent: Indent { block_indent: 8, alignment: 0 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] write_snippet `\n        \n\n        // Section: impl NewWithNullPtr\n\n        `\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] Normal: \"\\n        \\n\\n        \"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] Comment: \"// Section: impl NewWithNullPtr\\n\"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] Normal: \"\\n        \"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::items] compute_budgets_for_params 20 Indent { block_indent: 4, alignment: 0 }, 7, SameLine\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::items] rewrite_fn_base: one_line_budget: 64, multi_line_budget: 91, param_indent: Indent { block_indent: 8, alignment: 0 }\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] visit_block: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:100:44: 102:14\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:101:17: 101:37\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::visitor] close_block: Normal 0 \"\\n            \"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] write_snippet `\n\n        \n\n\n\n\n\n\n\n        // Section: impl IntoDart\n        \n\n\n\n\n\n\n\n        // Section: executor\n        `\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] Normal: \"\\n\\n        \\n\\n\\n\\n\\n\\n\\n\\n        \"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] Comment: \"// Section: impl IntoDart\\n\"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] Normal: \"        \\n\\n\\n\\n\\n\\n\\n\\n        \"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] Comment: \"// Section: executor\\n\"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::missed_spans] Normal: \"        \"\n[2021-10-21T20:16:09Z DEBUG rustfmt_nightly::formatting] track truncate: 2125 3\n" }
[2021-10-21T20:16:09Z DEBUG flutter_rust_bridge_codegen::commands] execute cbindgen rust_crate_dir=/home/consulting/Documents/native_add/rust c_output_path=/tmp/.tmpxBLr2F.h
[2021-10-21T20:16:09Z DEBUG flutter_rust_bridge_codegen::commands] cbindgen config:
    language = "C"
    [export]
    include = []

[2021-10-21T20:16:09Z DEBUG flutter_rust_bridge_codegen::commands] cbindgen config_file: NamedTempFile("/tmp/.tmpcn3QuO")
[2021-10-21T20:16:09Z DEBUG flutter_rust_bridge_codegen::commands] execute command: "cbindgen" "-v" "--config" "/tmp/.tmpcn3QuO" "--output" "/tmp/.tmpxBLr2F.h"
[2021-10-21T20:16:09Z DEBUG flutter_rust_bridge_codegen::commands] command="cbindgen" "-v" "--config" "/tmp/.tmpcn3QuO" "--output" "/tmp/.tmpxBLr2F.h" output=Output { status: ExitStatus(unix_wait_status(0)), stdout: "", stderr: "INFO: Take native_add::wire_add.\nINFO: Take native_add::wire_uint_8_list.\nINFO: Take native_add::new_uint_8_list.\nINFO: Take native_add::DartPort.\nINFO: Take native_add::DartPostCObjectFnType.\nINFO: Take native_add::store_dart_post_cobject.\n" }
[2021-10-21T20:16:09Z DEBUG flutter_rust_bridge_codegen::commands] execute ffigen c_path=/tmp/.tmpxBLr2F.h dart_path=/tmp/.tmps1FPWs
[2021-10-21T20:16:09Z DEBUG flutter_rust_bridge_codegen::commands] ffigen config:
            output: '/tmp/.tmps1FPWs'
            name: 'NativeAddWire'
            description: 'generated by flutter_rust_bridge'
            headers:
              entry-points:
                - '/tmp/.tmpxBLr2F.h'
              include-directives:
                - '/tmp/.tmpxBLr2F.h'
            comments: false
            preamble: |
              // ignore_for_file: camel_case_types, non_constant_identifier_names, avoid_positional_boolean_parameters, annotate_overrides

[2021-10-21T20:16:09Z DEBUG flutter_rust_bridge_codegen::commands] ffigen config_file: NamedTempFile("/tmp/.tmpKyqmSr")
[2021-10-21T20:16:09Z DEBUG flutter_rust_bridge_codegen::commands] execute command: "dart" "pub" "global" "run" "ffigen" "--config" "/tmp/.tmpKyqmSr"
[2021-10-21T20:16:09Z DEBUG flutter_rust_bridge_codegen::commands] command="dart" "pub" "global" "run" "ffigen" "--config" "/tmp/.tmpKyqmSr" output=Output { status: ExitStatus(unix_wait_status(0)), stdout: "Running in Directory: '/home/consulting/Documents/native_add'\nInput Headers: [/tmp/.tmpxBLr2F.h]\n[SEVERE] : Header /tmp/.tmpxBLr2F.h: Total errors/warnings: 1.\n[SEVERE] :     /tmp/.tmpxBLr2F.h:1:10: fatal error: 'stdarg.h' file not found [Lexical or Preprocessor Issue]\nFinished, Bindings generated in /tmp/.tmps1FPWs\n", stderr: "" }
[2021-10-21T20:16:09Z DEBUG flutter_rust_bridge_codegen::commands] execute format_dart path=/home/consulting/Documents/native_add/lib/bridge_generated.dart line_length=80
[2021-10-21T20:16:09Z DEBUG flutter_rust_bridge_codegen::commands] execute command: "dart" "format" "/home/consulting/Documents/native_add/lib/bridge_generated.dart" "--line-length" "80"
[2021-10-21T20:16:10Z DEBUG flutter_rust_bridge_codegen::commands] command="dart" "format" "/home/consulting/Documents/native_add/lib/bridge_generated.dart" "--line-length" "80" output=Output { status: ExitStatus(unix_wait_status(0)), stdout: "Formatted /home/consulting/Documents/native_add/lib/bridge_generated.dart\nFormatted 1 file (1 changed) in 0.14 seconds.\n", stderr: "" }
[2021-10-21T20:16:10Z INFO  flutter_rust_bridge_codegen] Success! Now go and use it :)

Generated binding code

The Dart code:

// AUTO GENERATED FILE, DO NOT EDIT.
// Generated by `flutter_rust_bridge`.

// ignore_for_file: non_constant_identifier_names, unused_element, duplicate_ignore, directives_ordering, curly_braces_in_flow_control_structures, unnecessary_lambdas
import 'dart:convert';
import 'dart:typed_data';

import 'package:flutter_rust_bridge/flutter_rust_bridge.dart';
import 'dart:ffi' as ffi;

abstract class NativeAdd extends FlutterRustBridgeBase<NativeAddWire> {
  factory NativeAdd(ffi.DynamicLibrary dylib) =>
      NativeAddImpl.raw(NativeAddWire(dylib));

  NativeAdd.raw(NativeAddWire inner) : super(inner);

  Future<String> add({required int left, required int right, dynamic hint});
}

// ------------------------- Implementation Details -------------------------

/// Implementations for NativeAdd. Prefer using NativeAdd if possible; but this class allows more
/// flexible customizations (such as subclassing to create an initializer, a logger, or
/// a timer).
class NativeAddImpl extends NativeAdd {
  NativeAddImpl.raw(NativeAddWire inner) : super.raw(inner);

  Future<String> add({required int left, required int right, dynamic hint}) =>
      executeNormal(FlutterRustBridgeTask(
          debugName: 'add',
          callFfi: (port) =>
              inner.wire_add(port, _api2wire_i32(left), _api2wire_i32(right)),
          parseSuccessData: _wire2api_String,
          hint: hint));

  // Section: api2wire
  int _api2wire_i32(int raw) {
    return raw;
  }

  ffi.Pointer<wire_uint_8_list> _api2wire_String(String raw) {
    return _api2wire_uint_8_list(utf8.encoder.convert(raw));
  }

  ffi.Pointer<wire_uint_8_list> _api2wire_uint_8_list(Uint8List raw) {
    final ans = inner.new_uint_8_list(raw.length);
    ans.ref.ptr.asTypedList(raw.length).setAll(0, raw);
    return ans;
  }

  int _api2wire_u8(int raw) {
    return raw;
  }

  // Section: api_fill_to_wire

}

// Section: wire2api
int _wire2api_i32(dynamic raw) {
  return raw as int;
}

String _wire2api_String(dynamic raw) {
  return raw as String;
}

Uint8List _wire2api_uint_8_list(dynamic raw) {
  return raw as Uint8List;
}

int _wire2api_u8(dynamic raw) {
  return raw as int;
}

// ignore_for_file: camel_case_types, non_constant_identifier_names, avoid_positional_boolean_parameters, annotate_overrides

// AUTO GENERATED FILE, DO NOT EDIT.
//
// Generated by `package:ffigen`.

/// generated by flutter_rust_bridge
class NativeAddWire 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].
  NativeAddWire(ffi.DynamicLibrary dynamicLibrary)
      : _lookup = dynamicLibrary.lookup;

  /// The symbols are looked up with [lookup].
  NativeAddWire.fromLookup(
      ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
          lookup)
      : _lookup = lookup;

  void wire_add(
    int port,
    int left,
    int right,
  ) {
    return _wire_add(
      port,
      left,
      right,
    );
  }

  late final _wire_addPtr = _lookup<
      ffi.NativeFunction<
          ffi.Void Function(ffi.Int64, ffi.Int32, ffi.Int32)>>('wire_add');
  late final _wire_add =
      _wire_addPtr.asFunction<void Function(int, int, int)>();

  ffi.Pointer<wire_uint_8_list> new_uint_8_list(
    int len,
  ) {
    return _new_uint_8_list(
      len,
    );
  }

  late final _new_uint_8_listPtr = _lookup<
      ffi.NativeFunction<
          ffi.Pointer<wire_uint_8_list> Function(
              ffi.Int32)>>('new_uint_8_list');
  late final _new_uint_8_list = _new_uint_8_listPtr
      .asFunction<ffi.Pointer<wire_uint_8_list> Function(int)>();

  void store_dart_post_cobject(
    int ptr,
  ) {
    return _store_dart_post_cobject(
      ptr,
    );
  }

  late final _store_dart_post_cobjectPtr =
      _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int32)>>(
          'store_dart_post_cobject');
  late final _store_dart_post_cobject =
      _store_dart_post_cobjectPtr.asFunction<void Function(int)>();
}

class wire_uint_8_list extends ffi.Struct {
  external ffi.Pointer<ffi.Uint8> ptr;

  @ffi.Int32()
  external int len;
}

The C header:

#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>

typedef struct wire_uint_8_list {
  uint8_t *ptr;
  int32_t len;
} wire_uint_8_list;

typedef int64_t DartPort;

typedef bool (*DartPostCObjectFnType)(DartPort port_id, void *message);

void wire_add(int64_t port, int32_t left, int32_t right);

struct wire_uint_8_list *new_uint_8_list(int32_t len);

void store_dart_post_cobject(DartPostCObjectFnType ptr);

static int64_t dummy_method_to_enforce_bundling(void) {
    int64_t dummy_var = 0;
    dummy_var ^= ((int64_t) (void*) wire_add);
    dummy_var ^= ((int64_t) (void*) new_uint_8_list);
    dummy_var ^= ((int64_t) (void*) store_dart_post_cobject);
    return dummy_var;
}
@Michael-F-Bryan Michael-F-Bryan added the bug Something isn't working label Oct 21, 2021
@welcome
Copy link

welcome bot commented Oct 21, 2021

Hi! Thanks for opening your first issue here! 😄

@Michael-F-Bryan
Copy link
Contributor Author

We're looking at using this crate for work so I'd be happy to contribute a fix. @fzyzcjy, do you have any suggestions for where I might want to start looking?

I noticed the example uses a DartPostCObjectFnType while the code generated by flutter_rust_bridge_codegen 1.2.0 (and master) generates a function that takes an int. Was there a change made somewhere which updated the flutter_rust_bridge Dart package but not the flutter_rust_bridge_codegen tool?

@fzyzcjy
Copy link
Owner

fzyzcjy commented Oct 22, 2021

Thanks for the reply, and thanks for your interest! Let me have a look.

@fzyzcjy
Copy link
Owner

fzyzcjy commented Oct 22, 2021

Aha look at this line:

[2021-10-21T20:16:09Z DEBUG flutter_rust_bridge_codegen::commands] command="dart" "pub" "global" "run" "ffigen" "--config" "/tmp/.tmpKyqmSr" output=Output { status: ExitStatus(unix_wait_status(0)), stdout: "Running in Directory: '/home/consulting/Documents/native_add'\nInput Headers: [/tmp/.tmpxBLr2F.h]\n[SEVERE] : Header /tmp/.tmpxBLr2F.h: Total errors/warnings: 1.\n[SEVERE] : /tmp/.tmpxBLr2F.h:1:10: fatal error: 'stdarg.h' file not found [Lexical or Preprocessor Issue]\nFinished, Bindings generated in /tmp/.tmps1FPWs\n", stderr: "" }

It says:

fatal error: 'stdarg.h' file not found

That seems to be the cause!

@fzyzcjy
Copy link
Owner

fzyzcjy commented Oct 22, 2021

Seems the same issue as: #53

@fzyzcjy
Copy link
Owner

fzyzcjy commented Oct 22, 2021

Please refer to dart-lang/native#515 to see some discussions. In short: That is not a bug in this lib, but instead problem in the ffigen (https://pub.dev/packages/ffigen). The code in our package just calls a normal command using Rust's Command, and you can call that command directly in your shell (dart pub global run ffigen ...), and maybe fire an issue in ffigen.

Dart packages
Generator for FFI bindings, using LibClang to parse C header files.

@fzyzcjy fzyzcjy changed the title The generated XXXWire.store_dart_post_cobject() has the wrong signature The generated XXXWire.store_dart_post_cobject() has the wrong signature - caused by ffigen third-party library's fatal error 'stdarg.h' file not found Oct 22, 2021
@fzyzcjy
Copy link
Owner

fzyzcjy commented Oct 22, 2021

By the way, stdarg.h is not directly required by this package. It is automatically generated via cbindgen lib. So you may also look at that library for why it includes that header.

EDIT:

Well, I see: https://en.wikipedia.org/wiki/Stdarg.h

allows functions to accept an indefinite number of arguments

But we never generate that kind of code.

Ok, so we can just throw away this header include. Wait a minute.

@fzyzcjy fzyzcjy reopened this Oct 22, 2021
@fzyzcjy
Copy link
Owner

fzyzcjy commented Oct 22, 2021

A fix is created. After the CI passes, could you please have a try on it?

@Michael-F-Bryan
Copy link
Contributor Author

I just installed d5f3d88 and now it complains about a missing stdbool.h.

[2021-10-22T14:26:49Z WARN  flutter_rust_bridge_codegen::commands] See keywords such as `error` in command output. Maybe there is a problem? command="dart" "pub" "global" "run" "ffigen" "--config" "/tmp/.tmpujjAL7" output=Output { status: ExitStatus(unix_wait_status(0)), stdout: "Running in Directory: '/home/consulting/Documents/native_add'\nInput Headers: [/tmp/.tmprU6Am6.h]\n[SEVERE] : Header /tmp/.tmprU6Am6.h: Total errors/warnings: 1.\n[SEVERE] :     /tmp/.tmprU6Am6.h:1:10: fatal error: 'stdbool.h' file not found [Lexical or Preprocessor Issue]\nFinished, Bindings generated in /tmp/.tmplhKbge\n", stderr: "" }

Maybe something funny is going on with library search paths and cross compiling, because stdarg.h and stdbool.h are part of libc and should always be available.

@fzyzcjy
Copy link
Owner

fzyzcjy commented Oct 22, 2021

could you please try what i suggested in dart-lang/native#515 , and see whether it works

@Michael-F-Bryan
Copy link
Contributor Author

Looks like this works when we run flutter_rust_bridge_codegen from / 🥳

$ export REPO_DIR=$PWD
$ cd /

$ flutter_rust_bridge_codegen \
    --rust-input $REPO_DIR/rust/src/api.rs \
    --dart-output $REPO_DIR/lib/bridge_generated.dart \
    --c-output $REPO_DIR/ios/Classes/bridge_generated.h
[2021-10-22T14:39:33Z INFO  flutter_rust_bridge_codegen] Picked config: Opts { rust_input_path: "/home/consulting/Documents/native_add/rust/src/api.rs", dart_output_path: "/home/consulting/Documents/native_add/lib/bridge_generated.dart", c_output_path: "/home/consulting/Documents/native_add/ios/Classes/bridge_generated.h", rust_crate_dir: "/home/consulting/Documents/native_add/rust", rust_output_path: "/home/consulting/Documents/native_add/rust/src/bridge_generated.rs", class_name: "NativeAdd", dart_format_line_length: 80, skip_add_mod_to_lib: false }
[2021-10-22T14:39:33Z INFO  flutter_rust_bridge_codegen] Phase: Parse source code to AST
[2021-10-22T14:39:33Z INFO  flutter_rust_bridge_codegen] Phase: Parse AST to IR
[2021-10-22T14:39:33Z INFO  flutter_rust_bridge_codegen] Phase: Transform IR
[2021-10-22T14:39:33Z INFO  flutter_rust_bridge_codegen] Phase: Generate Rust code
[2021-10-22T14:39:33Z INFO  flutter_rust_bridge_codegen] Phase: Generate Dart code
[2021-10-22T14:39:33Z INFO  flutter_rust_bridge_codegen] Phase: Other things
[2021-10-22T14:39:34Z INFO  flutter_rust_bridge_codegen] Success! Now go and use it :)

$ cd $REPO_DIR

@fzyzcjy
Copy link
Owner

fzyzcjy commented Oct 23, 2021

Congratulations!

@fzyzcjy fzyzcjy closed this as completed Oct 23, 2021
@fzyzcjy fzyzcjy reopened this Oct 23, 2021
@fzyzcjy
Copy link
Owner

fzyzcjy commented Oct 23, 2021

Well, let me leave this open. I am not sure why this only succeeds if run from /... Indeed this seems to be a problem with Rust's built-in Command having trouble running some shell commands? And interestingly, CI passes...

@Michael-F-Bryan
Copy link
Contributor Author

Indeed this seems to be a problem with Rust's built-in Command having trouble running some shell commands?

Something funny might be happening with environment variables, the current directory, or the dart command itself.

Rust's std::process::Command is just a wrapper around fork+exec (*nix) or CreateProcess() (Windows), so I'm guessing you'd see the same behaviour with C's system() or Python's subprocess.run() as well.

@fzyzcjy
Copy link
Owner

fzyzcjy commented Oct 25, 2021

Sounds reasonable. In addition, could you please have a try on master branch? With #112 and #119, the behavior has changed - now we use sh -c something.

@Michael-F-Bryan
Copy link
Contributor Author

I just installed e19d4a0 and got the same warning:

$ cd ~/Documents/native_add
$ export REPO_DIR=$PWD
$ flutter_rust_bridge_codegen --rust-input $REPO_DIR/rust/src/api.rs --dart-output $REPO_DIR/lib/bridge_generated.dart --c-output $REPO_DIR/ios/Classes/bridge_generated.h
[2021-10-25T05:52:26Z INFO  flutter_rust_bridge_codegen] Picked config: Opts { rust_input_path: "/home/consulting/Documents/native_add/rust/src/api.rs", dart_output_path: "/home/consulting/Documents/native_add/lib/bridge_generated.dart", c_output_path: "/home/consulting/Documents/native_add/ios/Classes/bridge_generated.h", rust_crate_dir: "/home/consulting/Documents/native_add/rust", rust_output_path: "/home/consulting/Documents/native_add/rust/src/bridge_generated.rs", class_name: "NativeAdd", dart_format_line_length: 80, skip_add_mod_to_lib: false, llvm_path: "" }
[2021-10-25T05:52:26Z INFO  flutter_rust_bridge_codegen] Phase: Parse source code to AST
[2021-10-25T05:52:26Z INFO  flutter_rust_bridge_codegen] Phase: Parse AST to IR
[2021-10-25T05:52:26Z INFO  flutter_rust_bridge_codegen] Phase: Transform IR
[2021-10-25T05:52:26Z INFO  flutter_rust_bridge_codegen] Phase: Generate Rust code
[2021-10-25T05:52:26Z INFO  flutter_rust_bridge_codegen] Phase: Generate Dart code
[2021-10-25T05:52:26Z INFO  flutter_rust_bridge_codegen] Phase: Other things
[2021-10-25T05:52:28Z WARN  flutter_rust_bridge_codegen::commands] See keywords such as `error` in command output. Maybe there is a problem? command="sh" "-c" "dart pub global run ffigen --config /tmp/.tmpdgk6jo" output=Output { status: ExitStatus(unix_wait_status(0)), stdout: "Running in Directory: '/home/consulting/Documents/native_add'\nInput Headers: [/tmp/.tmpZoa4X6.h]\n[SEVERE] : Header /tmp/.tmpZoa4X6.h: Total errors/warnings: 1.\n[SEVERE] :     /tmp/.tmpZoa4X6.h:1:10: fatal error: 'stdbool.h' file not found [Lexical or Preprocessor Issue]\nFinished, Bindings generated in /tmp/.tmpGcFynX\n", stderr: "" }
[2021-10-25T05:52:28Z INFO  flutter_rust_bridge_codegen] Success! Now go and use it :)

@fzyzcjy
Copy link
Owner

fzyzcjy commented Oct 25, 2021

Ok... So is the generated code good or bad? Btw to examine the details, RUST_LOG=debug is always needed.

@Michael-F-Bryan
Copy link
Contributor Author

Sorry, I saw the logs from ffigen say "fatal error" and assumed it was still failing.

I've re-run flutter_rust_bridge_codegen (Michael-F-Bryan/native_add@9fbd16f) from / and the generated bindings seem to be correct now.

Debug Logs
[2021-10-25T07:09:47Z INFO  flutter_rust_bridge_codegen] Picked config: Opts { rust_input_path: "/home/consulting/Documents/native_add/rust/src/api.rs", dart_output_path: "/home/consulting/Documents/native_add/lib/bridge_generated.dart", c_output_path: "/home/consulting/Documents/native_add/ios/Classes/bridge_generated.h", rust_crate_dir: "/home/consulting/Documents/native_add/rust", rust_output_path: "/home/consulting/Documents/native_add/rust/src/bridge_generated.rs", class_name: "NativeAdd", dart_format_line_length: 80, skip_add_mod_to_lib: false, llvm_path: "" }
[2021-10-25T07:09:47Z INFO  flutter_rust_bridge_codegen] Phase: Parse source code to AST
[2021-10-25T07:09:47Z INFO  flutter_rust_bridge_codegen] Phase: Parse AST to IR
[2021-10-25T07:09:47Z DEBUG flutter_rust_bridge_codegen::parser] parse_function function name: Ident(add)
[2021-10-25T07:09:47Z DEBUG flutter_rust_bridge_codegen::parser] parse_type: i32
[2021-10-25T07:09:47Z DEBUG flutter_rust_bridge_codegen::parser] parse_type: i32
[2021-10-25T07:09:47Z DEBUG flutter_rust_bridge_codegen::parser] parse_type: String
[2021-10-25T07:09:47Z DEBUG flutter_rust_bridge_codegen] parsed functions: ApiFile { funcs: [ApiFunc { name: "add", inputs: [ApiField { ty: Primitive(I32), name: ApiIdent { raw: "left" } }, ApiField { ty: Primitive(I32), name: ApiIdent { raw: "right" } }], output: Delegate(String), mode: Normal }], struct_pool: {}, has_executor: false }
[2021-10-25T07:09:47Z INFO  flutter_rust_bridge_codegen] Phase: Transform IR
[2021-10-25T07:09:47Z DEBUG flutter_rust_bridge_codegen] transformed functions: ApiFile { funcs: [ApiFunc { name: "add", inputs: [ApiField { ty: Primitive(I32), name: ApiIdent { raw: "left" } }, ApiField { ty: Primitive(I32), name: ApiIdent { raw: "right" } }], output: Delegate(String), mode: Normal }], struct_pool: {}, has_executor: false }
[2021-10-25T07:09:47Z INFO  flutter_rust_bridge_codegen] Phase: Generate Rust code
[2021-10-25T07:09:47Z INFO  flutter_rust_bridge_codegen] Phase: Generate Dart code
[2021-10-25T07:09:47Z DEBUG flutter_rust_bridge_codegen::generator_dart] distinct_types=[Primitive(I32), Delegate(String), PrimitiveList(ApiTypePrimitiveList { primitive: U8 }), Primitive(U8)]
[2021-10-25T07:09:47Z INFO  flutter_rust_bridge_codegen] Phase: Other things
[2021-10-25T07:09:47Z DEBUG flutter_rust_bridge_codegen::commands] execute format_rust path=/home/consulting/Documents/native_add/rust/src/bridge_generated.rs
[2021-10-25T07:09:47Z DEBUG flutter_rust_bridge_codegen::commands] execute command: arg="rustfmt /home/consulting/Documents/native_add/rust/src/bridge_generated.rs" current_dir=None cmd="sh" "-c" "rustfmt /home/consulting/Documents/native_add/rust/src/bridge_generated.rs"
[2021-10-25T07:09:47Z DEBUG flutter_rust_bridge_codegen::commands] command="sh" "-c" "rustfmt /home/consulting/Documents/native_add/rust/src/bridge_generated.rs" stdout= stderr=[2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] write_snippet `
            // AUTO GENERATED FILE, DO NOT EDIT.
    // Generated by `flutter_rust_bridge`.
    
            `
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] Normal: "\n        "
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] Comment: "// AUTO GENERATED FILE, DO NOT EDIT.\n// Generated by `flutter_rust_bridge`.\n"
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] Normal: "\n        "
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] write_snippet `
    
            // Section: wire functions
    
            
                    `
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] Normal: "\n\n        "
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] Comment: "// Section: wire functions\n"
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] Normal: "\n        \n                "
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::items] compute_budgets_for_params 26 Indent { block_indent: 0, alignment: 0 }, 0, SameLine
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::items] rewrite_fn_base: one_line_budget: 70, multi_line_budget: 95, param_indent: Indent { block_indent: 4, alignment: 0 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] visit_block: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:12:79: 19:18
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:14:17: 17:20
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::chains] rewrite_chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(435), hi: BytePos(462), ctxt: #0 }, segments: [PathSegment { ident: FLUTTER_RUST_BRIDGE_HANDLER#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(435), hi: BytePos(462), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(435), hi: BytePos(462), ctxt: #0 } }, children: [ChainItem { kind: MethodCall(PathSegment { ident: wrap#0, id: NodeId(4294967040), args: None }, [], [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(435), hi: BytePos(462), ctxt: #0 }, segments: [PathSegment { ident: FLUTTER_RUST_BRIDGE_HANDLER#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(435), hi: BytePos(462), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Expr { id: NodeId(4294967040), kind: Struct(StructExpr { qself: None, path: Path { span: Span { lo: BytePos(468), hi: BytePos(476), ctxt: #0 }, segments: [PathSegment { ident: WrapInfo#0, id: NodeId(4294967040), args: None }], tokens: None }, fields: [ExprField { attrs: ThinVec(None), id: NodeId(4294967040), span: Span { lo: BytePos(478), hi: BytePos(495), ctxt: #0 }, ident: debug_name#0, expr: Expr { id: NodeId(4294967040), kind: Lit(Lit { token: Lit { kind: Str, symbol: "add", suffix: None }, kind: Str("add", Cooked), span: Span { lo: BytePos(490), hi: BytePos(495), ctxt: #0 } }), span: Span { lo: BytePos(490), hi: BytePos(495), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, is_shorthand: false, is_placeholder: false }, ExprField { attrs: ThinVec(None), id: NodeId(4294967040), span: Span { lo: BytePos(497), hi: BytePos(501), ctxt: #0 }, ident: port#0, expr: Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(497), hi: BytePos(501), ctxt: #0 }, segments: [PathSegment { ident: port#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(497), hi: BytePos(501), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, is_shorthand: true, is_placeholder: false }, ExprField { attrs: ThinVec(None), id: NodeId(4294967040), span: Span { lo: BytePos(503), hi: BytePos(528), ctxt: #0 }, ident: mode#0, expr: Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(509), hi: BytePos(528), ctxt: #0 }, segments: [PathSegment { ident: FfiCallMode#0, id: NodeId(4294967040), args: None }, PathSegment { ident: Normal#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(509), hi: BytePos(528), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, is_shorthand: false, is_placeholder: false }], rest: None }), span: Span { lo: BytePos(468), hi: BytePos(530), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Expr { id: NodeId(4294967040), kind: Closure(Value, No, Movable, FnDecl { inputs: [], output: Default(Span { lo: BytePos(540), hi: BytePos(540), ctxt: #0 }) }, Expr { id: NodeId(4294967040), kind: Block(Block { stmts: [Stmt { id: NodeId(4294967040), kind: Local(Local { id: NodeId(4294967040), pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), api_left#0, None), span: Span { lo: BytePos(566), hi: BytePos(574), ctxt: #0 }, tokens: None }, ty: None, kind: Init(Expr { id: NodeId(4294967040), kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, segments: [PathSegment { ident: left#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, attrs: ThinVec(None), tokens: None }], Span { lo: BytePos(582), hi: BytePos(592), ctxt: #0 }), span: Span { lo: BytePos(577), hi: BytePos(592), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(562), hi: BytePos(593), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(562), hi: BytePos(593), ctxt: #0 } }, Stmt { id: NodeId(4294967040), kind: Local(Local { id: NodeId(4294967040), pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), api_right#0, None), span: Span { lo: BytePos(597), hi: BytePos(606), ctxt: #0 }, tokens: None }, ty: None, kind: Init(Expr { id: NodeId(4294967040), kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, segments: [PathSegment { ident: right#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, attrs: ThinVec(None), tokens: None }], Span { lo: BytePos(615), hi: BytePos(625), ctxt: #0 }), span: Span { lo: BytePos(609), hi: BytePos(625), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(593), hi: BytePos(626), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(593), hi: BytePos(626), ctxt: #0 } }, Stmt { id: NodeId(4294967040), kind: Expr(Expr { id: NodeId(4294967040), kind: Closure(Value, No, Movable, FnDecl { inputs: [Param { attrs: ThinVec(None), ty: Ty { id: NodeId(4294967040), kind: Infer, span: Span { lo: BytePos(653), hi: BytePos(666), ctxt: #0 }, tokens: None }, pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), task_callback#0, None), span: Span { lo: BytePos(653), hi: BytePos(666), ctxt: #0 }, tokens: None }, id: NodeId(4294967040), span: Span { lo: BytePos(653), hi: BytePos(667), ctxt: #0 }, is_placeholder: false }], output: Default(Span { lo: BytePos(668), hi: BytePos(668), ctxt: #0 }) }, Expr { id: NodeId(4294967040), kind: Call(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(668), hi: BytePos(671), ctxt: #0 }, segments: [PathSegment { ident: add#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(668), hi: BytePos(671), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(672), hi: BytePos(680), ctxt: #0 }, segments: [PathSegment { ident: api_left#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(672), hi: BytePos(680), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(682), hi: BytePos(691), ctxt: #0 }, segments: [PathSegment { ident: api_right#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(682), hi: BytePos(691), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), span: Span { lo: BytePos(668), hi: BytePos(692), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Span { lo: BytePos(647), hi: BytePos(667), ctxt: #0 }), span: Span { lo: BytePos(647), hi: BytePos(692), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(647), hi: BytePos(692), ctxt: #0 } }], id: NodeId(4294967040), rules: Default, span: Span { lo: BytePos(540), hi: BytePos(710), ctxt: #0 }, tokens: None, could_be_bare_literal: false }, None), span: Span { lo: BytePos(540), hi: BytePos(710), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Span { lo: BytePos(532), hi: BytePos(539), ctxt: #0 }), span: Span { lo: BytePos(532), hi: BytePos(710), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), tries: 0, span: Span { lo: BytePos(462), hi: BytePos(711), ctxt: #0 } }] } Shape { width: 95, indent: Indent { block_indent: 4, alignment: 0 }, offset: 0 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::chains] rewrite chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(435), hi: BytePos(462), ctxt: #0 }, segments: [PathSegment { ident: FLUTTER_RUST_BRIDGE_HANDLER#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(435), hi: BytePos(462), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(435), hi: BytePos(462), ctxt: #0 } }, children: [ChainItem { kind: MethodCall(PathSegment { ident: wrap#0, id: NodeId(4294967040), args: None }, [], [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(435), hi: BytePos(462), ctxt: #0 }, segments: [PathSegment { ident: FLUTTER_RUST_BRIDGE_HANDLER#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(435), hi: BytePos(462), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Expr { id: NodeId(4294967040), kind: Struct(StructExpr { qself: None, path: Path { span: Span { lo: BytePos(468), hi: BytePos(476), ctxt: #0 }, segments: [PathSegment { ident: WrapInfo#0, id: NodeId(4294967040), args: None }], tokens: None }, fields: [ExprField { attrs: ThinVec(None), id: NodeId(4294967040), span: Span { lo: BytePos(478), hi: BytePos(495), ctxt: #0 }, ident: debug_name#0, expr: Expr { id: NodeId(4294967040), kind: Lit(Lit { token: Lit { kind: Str, symbol: "add", suffix: None }, kind: Str("add", Cooked), span: Span { lo: BytePos(490), hi: BytePos(495), ctxt: #0 } }), span: Span { lo: BytePos(490), hi: BytePos(495), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, is_shorthand: false, is_placeholder: false }, ExprField { attrs: ThinVec(None), id: NodeId(4294967040), span: Span { lo: BytePos(497), hi: BytePos(501), ctxt: #0 }, ident: port#0, expr: Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(497), hi: BytePos(501), ctxt: #0 }, segments: [PathSegment { ident: port#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(497), hi: BytePos(501), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, is_shorthand: true, is_placeholder: false }, ExprField { attrs: ThinVec(None), id: NodeId(4294967040), span: Span { lo: BytePos(503), hi: BytePos(528), ctxt: #0 }, ident: mode#0, expr: Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(509), hi: BytePos(528), ctxt: #0 }, segments: [PathSegment { ident: FfiCallMode#0, id: NodeId(4294967040), args: None }, PathSegment { ident: Normal#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(509), hi: BytePos(528), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, is_shorthand: false, is_placeholder: false }], rest: None }), span: Span { lo: BytePos(468), hi: BytePos(530), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Expr { id: NodeId(4294967040), kind: Closure(Value, No, Movable, FnDecl { inputs: [], output: Default(Span { lo: BytePos(540), hi: BytePos(540), ctxt: #0 }) }, Expr { id: NodeId(4294967040), kind: Block(Block { stmts: [Stmt { id: NodeId(4294967040), kind: Local(Local { id: NodeId(4294967040), pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), api_left#0, None), span: Span { lo: BytePos(566), hi: BytePos(574), ctxt: #0 }, tokens: None }, ty: None, kind: Init(Expr { id: NodeId(4294967040), kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, segments: [PathSegment { ident: left#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, attrs: ThinVec(None), tokens: None }], Span { lo: BytePos(582), hi: BytePos(592), ctxt: #0 }), span: Span { lo: BytePos(577), hi: BytePos(592), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(562), hi: BytePos(593), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(562), hi: BytePos(593), ctxt: #0 } }, Stmt { id: NodeId(4294967040), kind: Local(Local { id: NodeId(4294967040), pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), api_right#0, None), span: Span { lo: BytePos(597), hi: BytePos(606), ctxt: #0 }, tokens: None }, ty: None, kind: Init(Expr { id: NodeId(4294967040), kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, segments: [PathSegment { ident: right#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, attrs: ThinVec(None), tokens: None }], Span { lo: BytePos(615), hi: BytePos(625), ctxt: #0 }), span: Span { lo: BytePos(609), hi: BytePos(625), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(593), hi: BytePos(626), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(593), hi: BytePos(626), ctxt: #0 } }, Stmt { id: NodeId(4294967040), kind: Expr(Expr { id: NodeId(4294967040), kind: Closure(Value, No, Movable, FnDecl { inputs: [Param { attrs: ThinVec(None), ty: Ty { id: NodeId(4294967040), kind: Infer, span: Span { lo: BytePos(653), hi: BytePos(666), ctxt: #0 }, tokens: None }, pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), task_callback#0, None), span: Span { lo: BytePos(653), hi: BytePos(666), ctxt: #0 }, tokens: None }, id: NodeId(4294967040), span: Span { lo: BytePos(653), hi: BytePos(667), ctxt: #0 }, is_placeholder: false }], output: Default(Span { lo: BytePos(668), hi: BytePos(668), ctxt: #0 }) }, Expr { id: NodeId(4294967040), kind: Call(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(668), hi: BytePos(671), ctxt: #0 }, segments: [PathSegment { ident: add#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(668), hi: BytePos(671), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(672), hi: BytePos(680), ctxt: #0 }, segments: [PathSegment { ident: api_left#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(672), hi: BytePos(680), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(682), hi: BytePos(691), ctxt: #0 }, segments: [PathSegment { ident: api_right#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(682), hi: BytePos(691), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), span: Span { lo: BytePos(668), hi: BytePos(692), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Span { lo: BytePos(647), hi: BytePos(667), ctxt: #0 }), span: Span { lo: BytePos(647), hi: BytePos(692), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(647), hi: BytePos(692), ctxt: #0 } }], id: NodeId(4294967040), rules: Default, span: Span { lo: BytePos(540), hi: BytePos(710), ctxt: #0 }, tokens: None, could_be_bare_literal: false }, None), span: Span { lo: BytePos(540), hi: BytePos(710), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Span { lo: BytePos(532), hi: BytePos(539), ctxt: #0 }), span: Span { lo: BytePos(532), hi: BytePos(710), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), tries: 0, span: Span { lo: BytePos(462), hi: BytePos(711), ctxt: #0 } }] } Shape { width: 95, indent: Indent { block_indent: 4, alignment: 0 }, offset: 0 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::expr] rewrite_struct_lit: shape Shape { width: 91, indent: Indent { block_indent: 8, alignment: 0 }, offset: 0 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::comment] comment::changed_comment_content: false
    orig: 'WrapInfo{ debug_name: "add", port, mode: FfiCallMode::Normal }'
    new: 'WrapInfo {
                debug_name: "add",
                port,
                mode: FfiCallMode::Normal,
            }'
    raw_old: 
    raw_new: 
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::closures] rewrite_closure Expr { id: NodeId(4294967040), kind: Block(Block { stmts: [Stmt { id: NodeId(4294967040), kind: Local(Local { id: NodeId(4294967040), pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), api_left#0, None), span: Span { lo: BytePos(566), hi: BytePos(574), ctxt: #0 }, tokens: None }, ty: None, kind: Init(Expr { id: NodeId(4294967040), kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, segments: [PathSegment { ident: left#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, attrs: ThinVec(None), tokens: None }], Span { lo: BytePos(582), hi: BytePos(592), ctxt: #0 }), span: Span { lo: BytePos(577), hi: BytePos(592), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(562), hi: BytePos(593), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(562), hi: BytePos(593), ctxt: #0 } }, Stmt { id: NodeId(4294967040), kind: Local(Local { id: NodeId(4294967040), pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), api_right#0, None), span: Span { lo: BytePos(597), hi: BytePos(606), ctxt: #0 }, tokens: None }, ty: None, kind: Init(Expr { id: NodeId(4294967040), kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, segments: [PathSegment { ident: right#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, attrs: ThinVec(None), tokens: None }], Span { lo: BytePos(615), hi: BytePos(625), ctxt: #0 }), span: Span { lo: BytePos(609), hi: BytePos(625), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(593), hi: BytePos(626), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(593), hi: BytePos(626), ctxt: #0 } }, Stmt { id: NodeId(4294967040), kind: Expr(Expr { id: NodeId(4294967040), kind: Closure(Value, No, Movable, FnDecl { inputs: [Param { attrs: ThinVec(None), ty: Ty { id: NodeId(4294967040), kind: Infer, span: Span { lo: BytePos(653), hi: BytePos(666), ctxt: #0 }, tokens: None }, pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), task_callback#0, None), span: Span { lo: BytePos(653), hi: BytePos(666), ctxt: #0 }, tokens: None }, id: NodeId(4294967040), span: Span { lo: BytePos(653), hi: BytePos(667), ctxt: #0 }, is_placeholder: false }], output: Default(Span { lo: BytePos(668), hi: BytePos(668), ctxt: #0 }) }, Expr { id: NodeId(4294967040), kind: Call(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(668), hi: BytePos(671), ctxt: #0 }, segments: [PathSegment { ident: add#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(668), hi: BytePos(671), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(672), hi: BytePos(680), ctxt: #0 }, segments: [PathSegment { ident: api_left#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(672), hi: BytePos(680), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(682), hi: BytePos(691), ctxt: #0 }, segments: [PathSegment { ident: api_right#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(682), hi: BytePos(691), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), span: Span { lo: BytePos(668), hi: BytePos(692), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Span { lo: BytePos(647), hi: BytePos(667), ctxt: #0 }), span: Span { lo: BytePos(647), hi: BytePos(692), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(647), hi: BytePos(692), ctxt: #0 } }], id: NodeId(4294967040), rules: Default, span: Span { lo: BytePos(540), hi: BytePos(710), ctxt: #0 }, tokens: None, could_be_bare_literal: false }, None), span: Span { lo: BytePos(540), hi: BytePos(710), ctxt: #0 }, attrs: ThinVec(None), tokens: None }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] visit_block: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:14:122: 17:18
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:15:21: 15:52
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::items] Local::rewrite Local { id: NodeId(4294967040), pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), api_left#0, None), span: Span { lo: BytePos(566), hi: BytePos(574), ctxt: #0 }, tokens: None }, ty: None, kind: Init(Expr { id: NodeId(4294967040), kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, segments: [PathSegment { ident: left#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, attrs: ThinVec(None), tokens: None }], Span { lo: BytePos(582), hi: BytePos(592), ctxt: #0 }), span: Span { lo: BytePos(577), hi: BytePos(592), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(562), hi: BytePos(593), ctxt: #0 }, attrs: ThinVec(None), tokens: None } 88 Indent { block_indent: 12, alignment: 0 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::chains] rewrite_chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, segments: [PathSegment { ident: left#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 } }, children: [ChainItem { kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [], [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, segments: [PathSegment { ident: left#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), tries: 0, span: Span { lo: BytePos(581), hi: BytePos(592), ctxt: #0 } }] } Shape { width: 72, indent: Indent { block_indent: 12, alignment: 0 }, offset: 15 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::chains] rewrite chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, segments: [PathSegment { ident: left#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 } }, children: [ChainItem { kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [], [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, segments: [PathSegment { ident: left#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(577), hi: BytePos(581), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), tries: 0, span: Span { lo: BytePos(581), hi: BytePos(592), ctxt: #0 } }] } Shape { width: 72, indent: Indent { block_indent: 12, alignment: 0 }, offset: 15 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:15:52: 15:85
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::items] Local::rewrite Local { id: NodeId(4294967040), pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), api_right#0, None), span: Span { lo: BytePos(597), hi: BytePos(606), ctxt: #0 }, tokens: None }, ty: None, kind: Init(Expr { id: NodeId(4294967040), kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, segments: [PathSegment { ident: right#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, attrs: ThinVec(None), tokens: None }], Span { lo: BytePos(615), hi: BytePos(625), ctxt: #0 }), span: Span { lo: BytePos(609), hi: BytePos(625), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(593), hi: BytePos(626), ctxt: #0 }, attrs: ThinVec(None), tokens: None } 88 Indent { block_indent: 12, alignment: 0 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::chains] rewrite_chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, segments: [PathSegment { ident: right#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 } }, children: [ChainItem { kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [], [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, segments: [PathSegment { ident: right#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), tries: 0, span: Span { lo: BytePos(614), hi: BytePos(625), ctxt: #0 } }] } Shape { width: 71, indent: Indent { block_indent: 12, alignment: 0 }, offset: 16 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::chains] rewrite chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, segments: [PathSegment { ident: right#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 } }, children: [ChainItem { kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [], [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, segments: [PathSegment { ident: right#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(609), hi: BytePos(614), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), tries: 0, span: Span { lo: BytePos(614), hi: BytePos(625), ctxt: #0 } }] } Shape { width: 71, indent: Indent { block_indent: 12, alignment: 0 }, offset: 16 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:16:21: 16:66
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::closures] rewrite_closure Expr { id: NodeId(4294967040), kind: Call(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(668), hi: BytePos(671), ctxt: #0 }, segments: [PathSegment { ident: add#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(668), hi: BytePos(671), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(672), hi: BytePos(680), ctxt: #0 }, segments: [PathSegment { ident: api_left#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(672), hi: BytePos(680), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(682), hi: BytePos(691), ctxt: #0 }, segments: [PathSegment { ident: api_right#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(682), hi: BytePos(691), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), span: Span { lo: BytePos(668), hi: BytePos(692), ctxt: #0 }, attrs: ThinVec(None), tokens: None }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] close_block: Normal 0 "\n                "
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::comment] comment::changed_comment_content: false
    orig: '{
                        let api_left = left.wire2api();let api_right = right.wire2api();
                        move |task_callback| add(api_left, api_right)
                    }'
    new: '{
                let api_left = left.wire2api();
                let api_right = right.wire2api();
                move |task_callback| add(api_left, api_right)
            }'
    raw_old: 
    raw_new: 
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::comment] comment::changed_comment_content: false
    orig: 'move || {
                        let api_left = left.wire2api();let api_right = right.wire2api();
                        move |task_callback| add(api_left, api_right)
                    }'
    new: 'move || {
                let api_left = left.wire2api();
                let api_right = right.wire2api();
                move |task_callback| add(api_left, api_right)
            }'
    raw_old: 
    raw_new: 
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::comment] comment::changed_comment_content: false
    orig: 'FLUTTER_RUST_BRIDGE_HANDLER.wrap(WrapInfo{ debug_name: "add", port, mode: FfiCallMode::Normal }, move || {
                        let api_left = left.wire2api();let api_right = right.wire2api();
                        move |task_callback| add(api_left, api_right)
                    })'
    new: 'FLUTTER_RUST_BRIDGE_HANDLER.wrap(
            WrapInfo {
                debug_name: "add",
                port,
                mode: FfiCallMode::Normal,
            },
            move || {
                let api_left = left.wire2api();
                let api_right = right.wire2api();
                move |task_callback| add(api_left, api_right)
            },
        )'
    raw_old: 
    raw_new: 
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::comment] comment::changed_comment_content: false
    orig: 'FLUTTER_RUST_BRIDGE_HANDLER.wrap(WrapInfo{ debug_name: "add", port, mode: FfiCallMode::Normal }, move || {
                        let api_left = left.wire2api();let api_right = right.wire2api();
                        move |task_callback| add(api_left, api_right)
                    });'
    new: 'FLUTTER_RUST_BRIDGE_HANDLER.wrap(
            WrapInfo {
                debug_name: "add",
                port,
                mode: FfiCallMode::Normal,
            },
            move || {
                let api_left = left.wire2api();
                let api_right = right.wire2api();
                move |task_callback| add(api_left, api_right)
            },
        );'
    raw_old: 
    raw_new: 
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] close_block: Normal 0 "\n                \n                "
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::attr] item_str: 'Clone,'
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] write_snippet `
                
    
            // Section: wire structs
    
            
    
    
    
    
            `
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] Normal: "\n            \n\n        "
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] Comment: "// Section: wire structs\n"
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] Normal: "\n        \n\n\n\n\n        "
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] write_snippet `
            
    
    
    
            // Section: allocate functions
    
            
    
    
    
    
                    `
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] Normal: "\n        \n\n\n\n        "
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] Comment: "// Section: allocate functions\n"
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] Normal: "\n        \n\n\n\n\n                "
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::items] compute_budgets_for_params 33 Indent { block_indent: 0, alignment: 0 }, 24, SameLine
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::items] rewrite_fn_base: one_line_budget: 38, multi_line_budget: 95, param_indent: Indent { block_indent: 4, alignment: 0 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] visit_block: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:47:86: 50:18
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:48:21: 48:113
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::items] Local::rewrite Local { id: NodeId(4294967040), pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), ans#0, None), span: Span { lo: BytePos(1141), hi: BytePos(1144), ctxt: #0 }, tokens: None }, ty: None, kind: Init(Expr { id: NodeId(4294967040), kind: Struct(StructExpr { qself: None, path: Path { span: Span { lo: BytePos(1147), hi: BytePos(1163), ctxt: #0 }, segments: [PathSegment { ident: wire_uint_8_list#0, id: NodeId(4294967040), args: None }], tokens: None }, fields: [ExprField { attrs: ThinVec(None), id: NodeId(4294967040), span: Span { lo: BytePos(1166), hi: BytePos(1221), ctxt: #0 }, ident: ptr#0, expr: Expr { id: NodeId(4294967040), kind: Call(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1171), hi: BytePos(1196), ctxt: #0 }, segments: [PathSegment { ident: support#0, id: NodeId(4294967040), args: None }, PathSegment { ident: new_leak_vec_ptr#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1171), hi: BytePos(1196), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, [Expr { id: NodeId(4294967040), kind: Call(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1197), hi: BytePos(1213), ctxt: #0 }, segments: [PathSegment { ident: Default#0, id: NodeId(4294967040), args: None }, PathSegment { ident: default#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1197), hi: BytePos(1213), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, []), span: Span { lo: BytePos(1197), hi: BytePos(1215), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1217), hi: BytePos(1220), ctxt: #0 }, segments: [PathSegment { ident: len#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1217), hi: BytePos(1220), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), span: Span { lo: BytePos(1171), hi: BytePos(1221), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, is_shorthand: false, is_placeholder: false }, ExprField { attrs: ThinVec(None), id: NodeId(4294967040), span: Span { lo: BytePos(1223), hi: BytePos(1226), ctxt: #0 }, ident: len#0, expr: Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1223), hi: BytePos(1226), ctxt: #0 }, segments: [PathSegment { ident: len#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1223), hi: BytePos(1226), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, is_shorthand: true, is_placeholder: false }], rest: None }), span: Span { lo: BytePos(1147), hi: BytePos(1228), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(1137), hi: BytePos(1229), ctxt: #0 }, attrs: ThinVec(None), tokens: None } 96 Indent { block_indent: 4, alignment: 0 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::expr] rewrite_struct_lit: shape Shape { width: 85, indent: Indent { block_indent: 4, alignment: 0 }, offset: 10 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::comment] comment::changed_comment_content: false
    orig: 'wire_uint_8_list { ptr: support::new_leak_vec_ptr(Default::default(), len), len }'
    new: 'wire_uint_8_list {
            ptr: support::new_leak_vec_ptr(Default::default(), len),
            len,
        }'
    raw_old: 
    raw_new: 
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::expr] rewrite_struct_lit: shape Shape { width: 91, indent: Indent { block_indent: 8, alignment: 0 }, offset: 0 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::comment] comment::changed_comment_content: false
    orig: 'wire_uint_8_list { ptr: support::new_leak_vec_ptr(Default::default(), len), len }'
    new: 'wire_uint_8_list {
                ptr: support::new_leak_vec_ptr(Default::default(), len),
                len,
            }'
    raw_old: 
    raw_new: 
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::comment] comment::changed_comment_content: false
    orig: 'let ans = wire_uint_8_list { ptr: support::new_leak_vec_ptr(Default::default(), len), len };'
    new: 'let ans = wire_uint_8_list {
            ptr: support::new_leak_vec_ptr(Default::default(), len),
            len,
        };'
    raw_old: 
    raw_new: 
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:49:17: 49:47
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] close_block: Normal 0 "\n                "
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::items] compute_budgets_for_params 11 Indent { block_indent: 4, alignment: 0 }, 4, None
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::items] rewrite_fn_base: one_line_budget: 77, multi_line_budget: 91, param_indent: Indent { block_indent: 8, alignment: 0 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] write_snippet `
                
    
    
    
            // Section: impl Wire2Api
    
            `
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] Normal: "\n            \n\n\n\n        "
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] Comment: "// Section: impl Wire2Api\n"
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] Normal: "\n        "
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::items] compute_budgets_for_params 11 Indent { block_indent: 4, alignment: 0 }, 6, SameLine
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::items] rewrite_fn_base: one_line_budget: 74, multi_line_budget: 91, param_indent: Indent { block_indent: 8, alignment: 0 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] visit_block: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:62:38: 64:14
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:63:17: 63:21
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] close_block: Normal 0 "\n            "
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::items] compute_budgets_for_params 11 Indent { block_indent: 4, alignment: 0 }, 9, SameLine
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::items] rewrite_fn_base: one_line_budget: 71, multi_line_budget: 91, param_indent: Indent { block_indent: 8, alignment: 0 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] visit_block: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:69:41: 72:14
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:70:17: 70:52
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::items] Local::rewrite Local { id: NodeId(4294967040), pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), vec#0, None), span: Span { lo: BytePos(1668), hi: BytePos(1671), ctxt: #0 }, tokens: None }, ty: Some(Ty { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1673), hi: BytePos(1680), ctxt: #0 }, segments: [PathSegment { ident: Vec#0, id: NodeId(4294967040), args: Some(AngleBracketed(AngleBracketedArgs { span: Span { lo: BytePos(1676), hi: BytePos(1680), ctxt: #0 }, args: [Arg(Type(Ty { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1677), hi: BytePos(1679), ctxt: #0 }, segments: [PathSegment { ident: u8#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1677), hi: BytePos(1679), ctxt: #0 }, tokens: None }))] })) }], tokens: None }), span: Span { lo: BytePos(1673), hi: BytePos(1680), ctxt: #0 }, tokens: None }), kind: Init(Expr { id: NodeId(4294967040), kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1683), hi: BytePos(1687), ctxt: #0 }, segments: [PathSegment { ident: self#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1683), hi: BytePos(1687), ctxt: #0 }, attrs: ThinVec(None), tokens: None }], Span { lo: BytePos(1688), hi: BytePos(1698), ctxt: #0 }), span: Span { lo: BytePos(1683), hi: BytePos(1698), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(1664), hi: BytePos(1699), ctxt: #0 }, attrs: ThinVec(None), tokens: None } 92 Indent { block_indent: 8, alignment: 0 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::chains] rewrite_chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1683), hi: BytePos(1687), ctxt: #0 }, segments: [PathSegment { ident: self#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1683), hi: BytePos(1687), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(1683), hi: BytePos(1687), ctxt: #0 } }, children: [ChainItem { kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [], [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1683), hi: BytePos(1687), ctxt: #0 }, segments: [PathSegment { ident: self#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1683), hi: BytePos(1687), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), tries: 0, span: Span { lo: BytePos(1687), hi: BytePos(1698), ctxt: #0 } }] } Shape { width: 72, indent: Indent { block_indent: 8, alignment: 0 }, offset: 19 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::chains] rewrite chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1683), hi: BytePos(1687), ctxt: #0 }, segments: [PathSegment { ident: self#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1683), hi: BytePos(1687), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(1683), hi: BytePos(1687), ctxt: #0 } }, children: [ChainItem { kind: MethodCall(PathSegment { ident: wire2api#0, id: NodeId(4294967040), args: None }, [], [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1683), hi: BytePos(1687), ctxt: #0 }, segments: [PathSegment { ident: self#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1683), hi: BytePos(1687), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), tries: 0, span: Span { lo: BytePos(1687), hi: BytePos(1698), ctxt: #0 } }] } Shape { width: 72, indent: Indent { block_indent: 8, alignment: 0 }, offset: 19 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:71:17: 71:59
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::chains] rewrite_chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Call(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1716), hi: BytePos(1739), ctxt: #0 }, segments: [PathSegment { ident: String#0, id: NodeId(4294967040), args: None }, PathSegment { ident: from_utf8_lossy#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1716), hi: BytePos(1739), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, [Expr { id: NodeId(4294967040), kind: AddrOf(Ref, Not, Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1741), hi: BytePos(1744), ctxt: #0 }, segments: [PathSegment { ident: vec#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1741), hi: BytePos(1744), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(1740), hi: BytePos(1744), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), span: Span { lo: BytePos(1716), hi: BytePos(1745), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(1716), hi: BytePos(1745), ctxt: #0 } }, children: [ChainItem { kind: MethodCall(PathSegment { ident: into_owned#0, id: NodeId(4294967040), args: None }, [], [Expr { id: NodeId(4294967040), kind: Call(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1716), hi: BytePos(1739), ctxt: #0 }, segments: [PathSegment { ident: String#0, id: NodeId(4294967040), args: None }, PathSegment { ident: from_utf8_lossy#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1716), hi: BytePos(1739), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, [Expr { id: NodeId(4294967040), kind: AddrOf(Ref, Not, Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1741), hi: BytePos(1744), ctxt: #0 }, segments: [PathSegment { ident: vec#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1741), hi: BytePos(1744), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(1740), hi: BytePos(1744), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), span: Span { lo: BytePos(1716), hi: BytePos(1745), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), tries: 0, span: Span { lo: BytePos(1745), hi: BytePos(1758), ctxt: #0 } }] } Shape { width: 92, indent: Indent { block_indent: 8, alignment: 0 }, offset: 0 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::chains] rewrite chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Call(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1716), hi: BytePos(1739), ctxt: #0 }, segments: [PathSegment { ident: String#0, id: NodeId(4294967040), args: None }, PathSegment { ident: from_utf8_lossy#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1716), hi: BytePos(1739), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, [Expr { id: NodeId(4294967040), kind: AddrOf(Ref, Not, Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1741), hi: BytePos(1744), ctxt: #0 }, segments: [PathSegment { ident: vec#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1741), hi: BytePos(1744), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(1740), hi: BytePos(1744), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), span: Span { lo: BytePos(1716), hi: BytePos(1745), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(1716), hi: BytePos(1745), ctxt: #0 } }, children: [ChainItem { kind: MethodCall(PathSegment { ident: into_owned#0, id: NodeId(4294967040), args: None }, [], [Expr { id: NodeId(4294967040), kind: Call(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1716), hi: BytePos(1739), ctxt: #0 }, segments: [PathSegment { ident: String#0, id: NodeId(4294967040), args: None }, PathSegment { ident: from_utf8_lossy#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1716), hi: BytePos(1739), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, [Expr { id: NodeId(4294967040), kind: AddrOf(Ref, Not, Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1741), hi: BytePos(1744), ctxt: #0 }, segments: [PathSegment { ident: vec#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1741), hi: BytePos(1744), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(1740), hi: BytePos(1744), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), span: Span { lo: BytePos(1716), hi: BytePos(1745), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), tries: 0, span: Span { lo: BytePos(1745), hi: BytePos(1758), ctxt: #0 } }] } Shape { width: 92, indent: Indent { block_indent: 8, alignment: 0 }, offset: 0 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] close_block: Normal 0 "\n            "
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::items] compute_budgets_for_params 11 Indent { block_indent: 4, alignment: 0 }, 10, SameLine
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::items] rewrite_fn_base: one_line_budget: 70, multi_line_budget: 91, param_indent: Indent { block_indent: 8, alignment: 0 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] visit_block: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:77:42: 82:14
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:78:17: 81:14
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] visit_block: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:78:17: 81:14
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:79:17: 79:61
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::items] Local::rewrite Local { id: NodeId(4294967040), pat: Pat { id: NodeId(4294967040), kind: Ident(ByValue(Not), wrap#0, None), span: Span { lo: BytePos(1932), hi: BytePos(1936), ctxt: #0 }, tokens: None }, ty: None, kind: Init(Expr { id: NodeId(4294967040), kind: Call(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1939), hi: BytePos(1965), ctxt: #0 }, segments: [PathSegment { ident: support#0, id: NodeId(4294967040), args: None }, PathSegment { ident: box_from_leak_ptr#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1939), hi: BytePos(1965), ctxt: #0 }, attrs: ThinVec(None), tokens: None }, [Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(1966), hi: BytePos(1970), ctxt: #0 }, segments: [PathSegment { ident: self#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(1966), hi: BytePos(1970), ctxt: #0 }, attrs: ThinVec(None), tokens: None }]), span: Span { lo: BytePos(1939), hi: BytePos(1971), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), span: Span { lo: BytePos(1928), hi: BytePos(1972), ctxt: #0 }, attrs: ThinVec(None), tokens: None } 88 Indent { block_indent: 12, alignment: 0 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:80:17: 80:63
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::chains] rewrite_chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(2016), hi: BytePos(2020), ctxt: #0 }, segments: [PathSegment { ident: wrap#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(2016), hi: BytePos(2020), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(2016), hi: BytePos(2020), ctxt: #0 } }, children: [ChainItem { kind: StructField(ptr#0), tries: 0, span: Span { lo: BytePos(2020), hi: BytePos(2024), ctxt: #0 } }] } Shape { width: 83, indent: Indent { block_indent: 16, alignment: 0 }, offset: 0 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::chains] rewrite chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(2016), hi: BytePos(2020), ctxt: #0 }, segments: [PathSegment { ident: wrap#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(2016), hi: BytePos(2020), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(2016), hi: BytePos(2020), ctxt: #0 } }, children: [ChainItem { kind: StructField(ptr#0), tries: 0, span: Span { lo: BytePos(2020), hi: BytePos(2024), ctxt: #0 } }] } Shape { width: 83, indent: Indent { block_indent: 16, alignment: 0 }, offset: 0 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::chains] rewrite_chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(2026), hi: BytePos(2030), ctxt: #0 }, segments: [PathSegment { ident: wrap#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(2026), hi: BytePos(2030), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(2026), hi: BytePos(2030), ctxt: #0 } }, children: [ChainItem { kind: StructField(len#0), tries: 0, span: Span { lo: BytePos(2030), hi: BytePos(2034), ctxt: #0 } }] } Shape { width: 83, indent: Indent { block_indent: 16, alignment: 0 }, offset: 0 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::chains] rewrite chain Chain { parent: ChainItem { kind: Parent(Expr { id: NodeId(4294967040), kind: Path(None, Path { span: Span { lo: BytePos(2026), hi: BytePos(2030), ctxt: #0 }, segments: [PathSegment { ident: wrap#0, id: NodeId(4294967040), args: None }], tokens: None }), span: Span { lo: BytePos(2026), hi: BytePos(2030), ctxt: #0 }, attrs: ThinVec(None), tokens: None }), tries: 0, span: Span { lo: BytePos(2026), hi: BytePos(2030), ctxt: #0 } }, children: [ChainItem { kind: StructField(len#0), tries: 0, span: Span { lo: BytePos(2030), hi: BytePos(2034), ctxt: #0 } }] } Shape { width: 83, indent: Indent { block_indent: 16, alignment: 0 }, offset: 0 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] close_block: Normal 0 "\n            "
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::comment] comment::changed_comment_content: false
    orig: 'unsafe {
                    let wrap = support::box_from_leak_ptr(self);
                    support::vec_from_leak_ptr(wrap.ptr, wrap.len)
                }'
    new: 'unsafe {
                let wrap = support::box_from_leak_ptr(self);
                support::vec_from_leak_ptr(wrap.ptr, wrap.len)
            }'
    raw_old: 
    raw_new: 
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::comment] comment::changed_comment_content: false
    orig: 'unsafe {
                    let wrap = support::box_from_leak_ptr(self);
                    support::vec_from_leak_ptr(wrap.ptr, wrap.len)
                }'
    new: 'unsafe {
                let wrap = support::box_from_leak_ptr(self);
                support::vec_from_leak_ptr(wrap.ptr, wrap.len)
            }'
    raw_old: 
    raw_new: 
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] close_block: Normal 0 "\n            "
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::items] compute_budgets_for_params 11 Indent { block_indent: 4, alignment: 0 }, 5, SameLine
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::items] rewrite_fn_base: one_line_budget: 75, multi_line_budget: 91, param_indent: Indent { block_indent: 8, alignment: 0 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] visit_block: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:87:37: 89:14
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:88:17: 88:21
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] close_block: Normal 0 "\n            "
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::items] compute_budgets_for_params 20 Indent { block_indent: 4, alignment: 0 }, 7, None
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::items] rewrite_fn_base: one_line_budget: 65, multi_line_budget: 91, param_indent: Indent { block_indent: 8, alignment: 0 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] write_snippet `
            
    
            // Section: impl NewWithNullPtr
    
            `
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] Normal: "\n        \n\n        "
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] Comment: "// Section: impl NewWithNullPtr\n"
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] Normal: "\n        "
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::items] compute_budgets_for_params 20 Indent { block_indent: 4, alignment: 0 }, 7, SameLine
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::items] rewrite_fn_base: one_line_budget: 64, multi_line_budget: 91, param_indent: Indent { block_indent: 8, alignment: 0 }
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] visit_block: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:100:44: 102:14
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] visit_stmt: /home/consulting/Documents/native_add/rust/src/bridge_generated.rs:101:17: 101:37
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::visitor] close_block: Normal 0 "\n            "
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] write_snippet `
    
            
    
    
    
    
    
    
    
            // Section: impl IntoDart
            
    
    
    
    
    
    
    
            // Section: executor
            `
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] Normal: "\n\n        \n\n\n\n\n\n\n\n        "
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] Comment: "// Section: impl IntoDart\n"
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] Normal: "        \n\n\n\n\n\n\n\n        "
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] Comment: "// Section: executor\n"
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::missed_spans] Normal: "        "
    [2021-10-25T07:09:47Z DEBUG rustfmt_nightly::formatting] track truncate: 2125 3
    
[2021-10-25T07:09:47Z DEBUG flutter_rust_bridge_codegen::commands] execute cbindgen rust_crate_dir=/home/consulting/Documents/native_add/rust c_output_path=/tmp/.tmpZXxj9U.h
[2021-10-25T07:09:47Z DEBUG flutter_rust_bridge_codegen::commands] cbindgen config: 
    language = "C"
    
    # do NOT include "stdarg.h", see dart-lang/ffigen#108 and dart-lang/native#515
    sys_includes = ["stdbool.h", "stdint.h", "stdlib.h"]
    no_includes = true
    
    [export]
    include = []
    
[2021-10-25T07:09:47Z DEBUG flutter_rust_bridge_codegen::commands] cbindgen config_file: NamedTempFile("/tmp/.tmpOxaPsy")
[2021-10-25T07:09:47Z DEBUG flutter_rust_bridge_codegen::commands] execute command: arg="cbindgen -v --config /tmp/.tmpOxaPsy --output /tmp/.tmpZXxj9U.h" current_dir=Some("/home/consulting/Documents/native_add/rust") cmd="sh" "-c" "cbindgen -v --config /tmp/.tmpOxaPsy --output /tmp/.tmpZXxj9U.h"
[2021-10-25T07:09:47Z DEBUG flutter_rust_bridge_codegen::commands] command="sh" "-c" "cbindgen -v --config /tmp/.tmpOxaPsy --output /tmp/.tmpZXxj9U.h" stdout= stderr=INFO: Take native_add::wire_add.
    INFO: Take native_add::wire_uint_8_list.
    INFO: Take native_add::new_uint_8_list.
    INFO: Take native_add::DartPort.
    INFO: Take native_add::DartPostCObjectFnType.
    INFO: Take native_add::store_dart_post_cobject.
    
[2021-10-25T07:09:47Z DEBUG flutter_rust_bridge_codegen::commands] execute ffigen c_path=/tmp/.tmpZXxj9U.h dart_path=/tmp/.tmpb3MmaI llvm_path=""
[2021-10-25T07:09:47Z DEBUG flutter_rust_bridge_codegen::commands] ffigen config: 
            output: '/tmp/.tmpb3MmaI'
            name: 'NativeAddWire'
            description: 'generated by flutter_rust_bridge'
            headers:
              entry-points:
                - '/tmp/.tmpZXxj9U.h'
              include-directives:
                - '/tmp/.tmpZXxj9U.h'
            comments: false
            preamble: |
              // ignore_for_file: camel_case_types, non_constant_identifier_names, avoid_positional_boolean_parameters, annotate_overrides
            
[2021-10-25T07:09:47Z DEBUG flutter_rust_bridge_codegen::commands] ffigen config_file: NamedTempFile("/tmp/.tmpYykF2q")
[2021-10-25T07:09:47Z DEBUG flutter_rust_bridge_codegen::commands] execute command: arg="dart pub global run ffigen --config /tmp/.tmpYykF2q" current_dir=None cmd="sh" "-c" "dart pub global run ffigen --config /tmp/.tmpYykF2q"
[2021-10-25T07:09:48Z DEBUG flutter_rust_bridge_codegen::commands] command="sh" "-c" "dart pub global run ffigen --config /tmp/.tmpYykF2q" stdout=Running in Directory: '/'
    Input Headers: [/tmp/.tmpZXxj9U.h]
    Finished, Bindings generated in /tmp/.tmpb3MmaI
     stderr=
[2021-10-25T07:09:48Z DEBUG flutter_rust_bridge_codegen::commands] execute format_dart path=/home/consulting/Documents/native_add/lib/bridge_generated.dart line_length=80
[2021-10-25T07:09:48Z DEBUG flutter_rust_bridge_codegen::commands] execute command: arg="dart format /home/consulting/Documents/native_add/lib/bridge_generated.dart --line-length 80" current_dir=None cmd="sh" "-c" "dart format /home/consulting/Documents/native_add/lib/bridge_generated.dart --line-length 80"
[2021-10-25T07:09:49Z DEBUG flutter_rust_bridge_codegen::commands] command="sh" "-c" "dart format /home/consulting/Documents/native_add/lib/bridge_generated.dart --line-length 80" stdout=Formatted /home/consulting/Documents/native_add/lib/bridge_generated.dart
    Formatted 1 file (1 changed) in 0.12 seconds.
     stderr=
[2021-10-25T07:09:49Z INFO  flutter_rust_bridge_codegen] Success! Now go and use it :)

@fzyzcjy
Copy link
Owner

fzyzcjy commented Oct 25, 2021

Sounds great! So shall I close this issue now?

@fzyzcjy
Copy link
Owner

fzyzcjy commented Oct 25, 2021

In addition, do you still need to run on / instead of normal directory? If so I should add to README

@Michael-F-Bryan
Copy link
Contributor Author

I still need to run in / otherwise ffigen will generate invalid bindings.

Running from / is more of a workaround than a solution, though. So our options are to either reuse this ticket to track the underlying issue, or we could create a new ticket about ffigen not consistently generating the right bindings and mention this ticket in the description. It really depends on what works best for your workflow, though.

@fzyzcjy
Copy link
Owner

fzyzcjy commented Oct 26, 2021

I am OK for both of your suggestions (personally perferring creating a new issue).

By the way, have you created an issue in ffigen's github repo? If we can reproduce it we may ask there.

@Michael-F-Bryan
Copy link
Contributor Author

By the way, have you created an issue in ffigen's github repo? If we can reproduce it we may ask there.

I was able to reproduce it fairly reliably on my computer and created a ticket upstream - dart-lang/native#338. This seems to be an issue with how they locate system headers and running from / just happens to make things work.

@shekohex
Copy link

Hello everyone! and Hi @Michael-F-Bryan it is been a while! 😄

But yea, I found this issue a while ago while working on subsocial flutter SDK and the fix that I did is a bit of simple from the cbindgen configuration.

Here is the code from the build.rs:

    let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
    let config = cbindgen::Config {
        language: cbindgen::Language::C,
        documentation_style: cbindgen::DocumentationStyle::C99,
        line_length: 100,
        style: cbindgen::Style::Tag,
        no_includes: true,
        sys_includes: vec![String::from("stdint.h")],
        ..Default::default()
    };
    cbindgen::Builder::new()
        .with_crate(crate_dir)
        .with_config(config)
        .generate()
        .expect("Unable to generate bindings")
        .write_to_file("binding.h");

and the ffigen does not complain anymore about stdarg.h anymore because it is never gets generated in the first place.

Hope that helps.

@fzyzcjy
Copy link
Owner

fzyzcjy commented Nov 1, 2021

@shekohex I have made it that do not include stdarg.h: 11f1f3e

But seems that this strange bug still exists...

@trobanga
Copy link
Contributor

I've had the same bug when using ffigen directly.

My solution is to add the include path of clang includes e.g.

ffigen:
  name: App
  description: Bindings to `App`.
 ...
 ...
  compiler-opts:
    - '-I/usr/lib/clang/13.0.0/include/'

fzyzcjy added a commit that referenced this issue Nov 24, 2021
@trobanga
Copy link
Contributor

Is it be possible to add compiler-opts as an argument to flutter_rust_bridge_codegen?

@fzyzcjy
Copy link
Owner

fzyzcjy commented Nov 24, 2021

@trobanga Sure. People have added other flags previously dart-archive/ffigen#119 . Feel free to make a PR!

Hints:

@saward
Copy link

saward commented Jan 19, 2022

I've just been playing with this on Arch (after playing around with it on my Mac laptop), and I hit this issue. Confirming that running from / also works for me.

@fzyzcjy
Copy link
Owner

fzyzcjy commented Jan 19, 2022

@saward Thanks

@fzyzcjy fzyzcjy mentioned this issue Feb 12, 2022
10 tasks
@fzyzcjy
Copy link
Owner

fzyzcjy commented Feb 12, 2022

Since we have documented it, I will close it. Feel free to reopen or create a new issue if you like!

@fzyzcjy fzyzcjy closed this as completed Feb 12, 2022
@github-actions
Copy link
Contributor

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 26, 2022
Czappi pushed a commit to Czappi/flutter_rust_bridge that referenced this issue Nov 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants