Repository navigation
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
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.hNow, 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
Details
$ 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
Details
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;
}Reacted by fzyzcjy and Waridley
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Activity
welcome commentedon Oct 21, 2021
Hi! Thanks for opening your first issue here! 😄
Michael-F-Bryan commentedon Oct 21, 2021
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
DartPostCObjectFnTypewhile the code generated byflutter_rust_bridge_codegen 1.2.0(andmaster) generates a function that takes an int. Was there a change made somewhere which updated theflutter_rust_bridgeDart package but not theflutter_rust_bridge_codegentool?fzyzcjy commentedon Oct 22, 2021
Thanks for the reply, and thanks for your interest! Let me have a look.
fzyzcjy commentedon 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 foundThat seems to be the cause!
fzyzcjy commentedon Oct 22, 2021
Seems the same issue as: #53
fzyzcjy commentedon 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'sCommand, and you can call that command directly in your shell (dart pub global run ffigen ...), and maybe fire an issue in ffigen.[-]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`[/+]fzyzcjy commentedon Oct 22, 2021
By the way,
stdarg.his not directly required by this package. It is automatically generated viacbindgenlib. 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
But we never generate that kind of code.
Ok, so we can just throw away this header include. Wait a minute.
fzyzcjy commentedon Oct 22, 2021
A fix is created. After the CI passes, could you please have a try on it?
Michael-F-Bryan commentedon Oct 22, 2021
I just installed d5f3d88 and now it complains about a missing
stdbool.h.Maybe something funny is going on with library search paths and cross compiling, because
stdarg.handstdbool.hare part oflibcand should always be available.17 remaining items
fzyzcjy commentedon 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 commentedon Oct 29, 2021
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 commentedon Oct 31, 2021
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
cbindgenconfiguration.Here is the code from the
build.rs:and the
ffigendoes not complain anymore aboutstdarg.hanymore because it is never gets generated in the first place.Hope that helps.
fzyzcjy commentedon Nov 1, 2021
@shekohex I have made it that do not include stdarg.h: 11f1f3e
But seems that this strange bug still exists...
trobanga commentedon Nov 24, 2021
I've had the same bug when using ffigen directly.
My solution is to add the include path of clang includes e.g.
make readme more clear about #108
trobanga commentedon Nov 24, 2021
Is it be possible to add compiler-opts as an argument to flutter_rust_bridge_codegen?
fzyzcjy commentedon Nov 24, 2021
@trobanga Sure. People have added other flags previously dart-archive/ffigen#119 . Feel free to make a PR!
Hints:
flutter_rust_bridge/frb_codegen/src/commands.rs
Line 137 in 5c65b17
flutter_rust_bridge/frb_codegen/src/config.rs
Line 42 in 18d3aab
saward commentedon 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 commentedon Jan 19, 2022
@saward Thanks
fzyzcjy commentedon Feb 12, 2022
Since we have documented it, I will close it. Feel free to reopen or create a new issue if you like!
github-actions commentedon Feb 26, 2022
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.
Do not include `stdarg.h` automatically to fix fzyzcjy#108 and fix fz…