From 393b960764ed17b8904b85ed1b2b5ef879ee6d3d Mon Sep 17 00:00:00 2001 From: SilverMira <66930495+SilverMira@users.noreply.github.com> Date: Thu, 28 Mar 2024 20:46:08 +0800 Subject: [PATCH] test: add test for StreamSink --- frb_example/pure_dart/frb_generated.h | 57 +++ .../pure_dart/lib/src/rust/api/mirror.dart | 6 + .../pseudo_manual/mirror_twin_rust_async.dart | 6 + .../mirror_twin_rust_async_sse.dart | 7 + .../api/pseudo_manual/mirror_twin_sse.dart | 6 + .../api/pseudo_manual/mirror_twin_sync.dart | 6 + .../pseudo_manual/mirror_twin_sync_sse.dart | 6 + .../pure_dart/lib/src/rust/frb_generated.dart | 366 ++++++++++++++++++ .../lib/src/rust/frb_generated.io.dart | 280 ++++++++++++++ .../lib/src/rust/frb_generated.web.dart | 141 +++++++ frb_example/pure_dart/rust/src/api/mirror.rs | 11 + .../pseudo_manual/mirror_twin_rust_async.rs | 11 + .../mirror_twin_rust_async_sse.rs | 17 + .../src/api/pseudo_manual/mirror_twin_sse.rs | 17 + .../src/api/pseudo_manual/mirror_twin_sync.rs | 13 + .../api/pseudo_manual/mirror_twin_sync_sse.rs | 19 + .../pure_dart/rust/src/frb_generated.io.rs | 113 ++++++ .../pure_dart/rust/src/frb_generated.rs | 240 ++++++++++++ .../pure_dart/rust/src/frb_generated.web.rs | 98 +++++ .../pure_dart/test/api/mirror_test.dart | 15 + .../mirror_twin_rust_async_sse_test.dart | 15 + .../mirror_twin_rust_async_test.dart | 15 + .../pseudo_manual/mirror_twin_sse_test.dart | 15 + .../mirror_twin_sync_sse_test.dart | 15 + .../pseudo_manual/mirror_twin_sync_test.dart | 15 + .../pure_dart_pde/rust/src/api/mirror.rs | 11 + .../pseudo_manual/mirror_twin_rust_async.rs | 11 + .../src/api/pseudo_manual/mirror_twin_sync.rs | 13 + .../pure_dart_pde/test/api/mirror_test.dart | 15 + .../mirror_twin_rust_async_test.dart | 15 + .../pseudo_manual/mirror_twin_sync_test.dart | 15 + .../rust/entrypoint.dart | 7 +- 32 files changed, 1596 insertions(+), 1 deletion(-) diff --git a/frb_example/pure_dart/frb_generated.h b/frb_example/pure_dart/frb_generated.h index bfc7bc47b0e..9e391adef99 100644 --- a/frb_example/pure_dart/frb_generated.h +++ b/frb_example/pure_dart/frb_generated.h @@ -3581,6 +3581,10 @@ void frbgen_frb_example_pure_dart_wire_get_message_twin_normal(int64_t port_); void frbgen_frb_example_pure_dart_wire_is_app_embedded_twin_normal(int64_t port_, struct wire_cst_application_settings *app_settings); +void frbgen_frb_example_pure_dart_wire_mirror_enum_stream_twin_normal(int64_t port_); + +void frbgen_frb_example_pure_dart_wire_mirror_option_enum_stream_twin_normal(int64_t port_); + void frbgen_frb_example_pure_dart_wire_mirror_struct_stream_twin_normal(int64_t port_); void frbgen_frb_example_pure_dart_wire_mirror_tuple_stream_twin_normal(int64_t port_); @@ -7950,6 +7954,10 @@ void frbgen_frb_example_pure_dart_wire_get_message_twin_rust_async(int64_t port_ void frbgen_frb_example_pure_dart_wire_is_app_embedded_twin_rust_async(int64_t port_, struct wire_cst_application_settings *app_settings); +void frbgen_frb_example_pure_dart_wire_mirror_enum_stream_twin_rust_async(int64_t port_); + +void frbgen_frb_example_pure_dart_wire_mirror_option_enum_stream_twin_rust_async(int64_t port_); + void frbgen_frb_example_pure_dart_wire_mirror_struct_stream_twin_rust_async(int64_t port_); void frbgen_frb_example_pure_dart_wire_mirror_tuple_stream_twin_rust_async(int64_t port_); @@ -8019,6 +8027,16 @@ void frbgen_frb_example_pure_dart_wire_is_app_embedded_twin_rust_async_sse(int64 int32_t rust_vec_len_, int32_t data_len_); +void frbgen_frb_example_pure_dart_wire_mirror_enum_stream_twin_rust_async_sse(int64_t port_, + uint8_t *ptr_, + int32_t rust_vec_len_, + int32_t data_len_); + +void frbgen_frb_example_pure_dart_wire_mirror_option_enum_stream_twin_rust_async_sse(int64_t port_, + uint8_t *ptr_, + int32_t rust_vec_len_, + int32_t data_len_); + void frbgen_frb_example_pure_dart_wire_mirror_struct_stream_twin_rust_async_sse(int64_t port_, uint8_t *ptr_, int32_t rust_vec_len_, @@ -8119,6 +8137,16 @@ void frbgen_frb_example_pure_dart_wire_is_app_embedded_twin_sse(int64_t port_, int32_t rust_vec_len_, int32_t data_len_); +void frbgen_frb_example_pure_dart_wire_mirror_enum_stream_twin_sse(int64_t port_, + uint8_t *ptr_, + int32_t rust_vec_len_, + int32_t data_len_); + +void frbgen_frb_example_pure_dart_wire_mirror_option_enum_stream_twin_sse(int64_t port_, + uint8_t *ptr_, + int32_t rust_vec_len_, + int32_t data_len_); + void frbgen_frb_example_pure_dart_wire_mirror_struct_stream_twin_sse(int64_t port_, uint8_t *ptr_, int32_t rust_vec_len_, @@ -8195,6 +8223,10 @@ WireSyncRust2DartDco frbgen_frb_example_pure_dart_wire_get_message_twin_sync(voi WireSyncRust2DartDco frbgen_frb_example_pure_dart_wire_is_app_embedded_twin_sync(struct wire_cst_application_settings *app_settings); +void frbgen_frb_example_pure_dart_wire_mirror_enum_stream_twin_sync(int64_t port_); + +void frbgen_frb_example_pure_dart_wire_mirror_option_enum_stream_twin_sync(int64_t port_); + void frbgen_frb_example_pure_dart_wire_mirror_struct_stream_twin_sync(int64_t port_); void frbgen_frb_example_pure_dart_wire_mirror_tuple_stream_twin_sync(int64_t port_); @@ -8255,6 +8287,16 @@ WireSyncRust2DartSse frbgen_frb_example_pure_dart_wire_is_app_embedded_twin_sync int32_t rust_vec_len_, int32_t data_len_); +void frbgen_frb_example_pure_dart_wire_mirror_enum_stream_twin_sync_sse(int64_t port_, + uint8_t *ptr_, + int32_t rust_vec_len_, + int32_t data_len_); + +void frbgen_frb_example_pure_dart_wire_mirror_option_enum_stream_twin_sync_sse(int64_t port_, + uint8_t *ptr_, + int32_t rust_vec_len_, + int32_t data_len_); + void frbgen_frb_example_pure_dart_wire_mirror_struct_stream_twin_sync_sse(int64_t port_, uint8_t *ptr_, int32_t rust_vec_len_, @@ -12795,6 +12837,8 @@ struct wire_cst_abc_twin_sync *frbgen_frb_example_pure_dart_cst_new_box_autoadd_ struct wire_cst_application_env *frbgen_frb_example_pure_dart_cst_new_box_autoadd_application_env(void); +int32_t *frbgen_frb_example_pure_dart_cst_new_box_autoadd_application_mode(int32_t value); + struct wire_cst_application_settings *frbgen_frb_example_pure_dart_cst_new_box_autoadd_application_settings(void); struct wire_cst_attribute_twin_normal *frbgen_frb_example_pure_dart_cst_new_box_autoadd_attribute_twin_normal(void); @@ -13540,6 +13584,7 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_cst_new_box_autoadd_abc_twin_rust_async); dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_cst_new_box_autoadd_abc_twin_sync); dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_cst_new_box_autoadd_application_env); + dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_cst_new_box_autoadd_application_mode); dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_cst_new_box_autoadd_application_settings); dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_cst_new_box_autoadd_attribute_twin_normal); dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_cst_new_box_autoadd_attribute_twin_rust_async); @@ -15803,6 +15848,18 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_wire_loop_back_vec_twin_sse); dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_wire_loop_back_vec_twin_sync); dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_wire_loop_back_vec_twin_sync_sse); + dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_wire_mirror_enum_stream_twin_normal); + dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_wire_mirror_enum_stream_twin_rust_async); + dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_wire_mirror_enum_stream_twin_rust_async_sse); + dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_wire_mirror_enum_stream_twin_sse); + dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_wire_mirror_enum_stream_twin_sync); + dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_wire_mirror_enum_stream_twin_sync_sse); + dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_wire_mirror_option_enum_stream_twin_normal); + dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_wire_mirror_option_enum_stream_twin_rust_async); + dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_wire_mirror_option_enum_stream_twin_rust_async_sse); + dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_wire_mirror_option_enum_stream_twin_sse); + dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_wire_mirror_option_enum_stream_twin_sync); + dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_wire_mirror_option_enum_stream_twin_sync_sse); dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_wire_mirror_struct_stream_twin_normal); dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_wire_mirror_struct_stream_twin_rust_async); dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_wire_mirror_struct_stream_twin_rust_async_sse); diff --git a/frb_example/pure_dart/lib/src/rust/api/mirror.dart b/frb_example/pure_dart/lib/src/rust/api/mirror.dart index f4a3ac0843d..865ac3cb34a 100644 --- a/frb_example/pure_dart/lib/src/rust/api/mirror.dart +++ b/frb_example/pure_dart/lib/src/rust/api/mirror.dart @@ -86,6 +86,12 @@ Future testHashmapWithMirroredValueTwinNormal( {dynamic hint}) => RustLib.instance.api.testHashmapWithMirroredValueTwinNormal(hint: hint); +Stream mirrorEnumStreamTwinNormal({dynamic hint}) => + RustLib.instance.api.mirrorEnumStreamTwinNormal(hint: hint); + +Stream mirrorOptionEnumStreamTwinNormal({dynamic hint}) => + RustLib.instance.api.mirrorOptionEnumStreamTwinNormal(hint: hint); + class AnotherTwinNormal { final String a; diff --git a/frb_example/pure_dart/lib/src/rust/api/pseudo_manual/mirror_twin_rust_async.dart b/frb_example/pure_dart/lib/src/rust/api/pseudo_manual/mirror_twin_rust_async.dart index dea6e515aea..ededa97d33f 100644 --- a/frb_example/pure_dart/lib/src/rust/api/pseudo_manual/mirror_twin_rust_async.dart +++ b/frb_example/pure_dart/lib/src/rust/api/pseudo_manual/mirror_twin_rust_async.dart @@ -90,6 +90,12 @@ Future testHashmapWithMirroredValueTwinRustAsync( {dynamic hint}) => RustLib.instance.api.testHashmapWithMirroredValueTwinRustAsync(hint: hint); +Stream mirrorEnumStreamTwinRustAsync({dynamic hint}) => + RustLib.instance.api.mirrorEnumStreamTwinRustAsync(hint: hint); + +Stream mirrorOptionEnumStreamTwinRustAsync({dynamic hint}) => + RustLib.instance.api.mirrorOptionEnumStreamTwinRustAsync(hint: hint); + class AnotherTwinRustAsync { final String a; diff --git a/frb_example/pure_dart/lib/src/rust/api/pseudo_manual/mirror_twin_rust_async_sse.dart b/frb_example/pure_dart/lib/src/rust/api/pseudo_manual/mirror_twin_rust_async_sse.dart index c2a51fa5ce5..700f3826905 100644 --- a/frb_example/pure_dart/lib/src/rust/api/pseudo_manual/mirror_twin_rust_async_sse.dart +++ b/frb_example/pure_dart/lib/src/rust/api/pseudo_manual/mirror_twin_rust_async_sse.dart @@ -95,6 +95,13 @@ Future testHashmapWithMirroredValueTwinRustAsyncSse( RustLib.instance.api .testHashmapWithMirroredValueTwinRustAsyncSse(hint: hint); +Stream mirrorEnumStreamTwinRustAsyncSse({dynamic hint}) => + RustLib.instance.api.mirrorEnumStreamTwinRustAsyncSse(hint: hint); + +Stream mirrorOptionEnumStreamTwinRustAsyncSse( + {dynamic hint}) => + RustLib.instance.api.mirrorOptionEnumStreamTwinRustAsyncSse(hint: hint); + class AnotherTwinRustAsyncSse { final String a; diff --git a/frb_example/pure_dart/lib/src/rust/api/pseudo_manual/mirror_twin_sse.dart b/frb_example/pure_dart/lib/src/rust/api/pseudo_manual/mirror_twin_sse.dart index 6c36b523808..d709bd899ac 100644 --- a/frb_example/pure_dart/lib/src/rust/api/pseudo_manual/mirror_twin_sse.dart +++ b/frb_example/pure_dart/lib/src/rust/api/pseudo_manual/mirror_twin_sse.dart @@ -82,6 +82,12 @@ Future testContainsMirroredSubStructTwinSse( Future testHashmapWithMirroredValueTwinSse({dynamic hint}) => RustLib.instance.api.testHashmapWithMirroredValueTwinSse(hint: hint); +Stream mirrorEnumStreamTwinSse({dynamic hint}) => + RustLib.instance.api.mirrorEnumStreamTwinSse(hint: hint); + +Stream mirrorOptionEnumStreamTwinSse({dynamic hint}) => + RustLib.instance.api.mirrorOptionEnumStreamTwinSse(hint: hint); + class AnotherTwinSse { final String a; diff --git a/frb_example/pure_dart/lib/src/rust/api/pseudo_manual/mirror_twin_sync.dart b/frb_example/pure_dart/lib/src/rust/api/pseudo_manual/mirror_twin_sync.dart index a62876aa1dd..4dfe3908e5f 100644 --- a/frb_example/pure_dart/lib/src/rust/api/pseudo_manual/mirror_twin_sync.dart +++ b/frb_example/pure_dart/lib/src/rust/api/pseudo_manual/mirror_twin_sync.dart @@ -82,6 +82,12 @@ ContainsMirroredSubStructTwinSync testContainsMirroredSubStructTwinSync( StructWithHashMap testHashmapWithMirroredValueTwinSync({dynamic hint}) => RustLib.instance.api.testHashmapWithMirroredValueTwinSync(hint: hint); +Stream mirrorEnumStreamTwinSync({dynamic hint}) => + RustLib.instance.api.mirrorEnumStreamTwinSync(hint: hint); + +Stream mirrorOptionEnumStreamTwinSync({dynamic hint}) => + RustLib.instance.api.mirrorOptionEnumStreamTwinSync(hint: hint); + class AnotherTwinSync { final String a; diff --git a/frb_example/pure_dart/lib/src/rust/api/pseudo_manual/mirror_twin_sync_sse.dart b/frb_example/pure_dart/lib/src/rust/api/pseudo_manual/mirror_twin_sync_sse.dart index de8a90c9bc3..29e5288cd74 100644 --- a/frb_example/pure_dart/lib/src/rust/api/pseudo_manual/mirror_twin_sync_sse.dart +++ b/frb_example/pure_dart/lib/src/rust/api/pseudo_manual/mirror_twin_sync_sse.dart @@ -85,6 +85,12 @@ ContainsMirroredSubStructTwinSyncSse testContainsMirroredSubStructTwinSyncSse( StructWithHashMap testHashmapWithMirroredValueTwinSyncSse({dynamic hint}) => RustLib.instance.api.testHashmapWithMirroredValueTwinSyncSse(hint: hint); +Stream mirrorEnumStreamTwinSyncSse({dynamic hint}) => + RustLib.instance.api.mirrorEnumStreamTwinSyncSse(hint: hint); + +Stream mirrorOptionEnumStreamTwinSyncSse({dynamic hint}) => + RustLib.instance.api.mirrorOptionEnumStreamTwinSyncSse(hint: hint); + class AnotherTwinSyncSse { final String a; diff --git a/frb_example/pure_dart/lib/src/rust/frb_generated.dart b/frb_example/pure_dart/lib/src/rust/frb_generated.dart index 0e81bd90897..eea1446fc1d 100644 --- a/frb_example/pure_dart/lib/src/rust/frb_generated.dart +++ b/frb_example/pure_dart/lib/src/rust/frb_generated.dart @@ -761,6 +761,10 @@ abstract class RustLibApi extends BaseApi { Future isAppEmbeddedTwinNormal( {required ApplicationSettings appSettings, dynamic hint}); + Stream mirrorEnumStreamTwinNormal({dynamic hint}); + + Stream mirrorOptionEnumStreamTwinNormal({dynamic hint}); + Stream mirrorStructStreamTwinNormal({dynamic hint}); Stream<(ApplicationSettings, RawStringEnumMirrored)> @@ -4173,6 +4177,10 @@ abstract class RustLibApi extends BaseApi { Future isAppEmbeddedTwinRustAsync( {required ApplicationSettings appSettings, dynamic hint}); + Stream mirrorEnumStreamTwinRustAsync({dynamic hint}); + + Stream mirrorOptionEnumStreamTwinRustAsync({dynamic hint}); + Stream mirrorStructStreamTwinRustAsync( {dynamic hint}); @@ -4229,6 +4237,11 @@ abstract class RustLibApi extends BaseApi { Future isAppEmbeddedTwinRustAsyncSse( {required ApplicationSettings appSettings, dynamic hint}); + Stream mirrorEnumStreamTwinRustAsyncSse({dynamic hint}); + + Stream mirrorOptionEnumStreamTwinRustAsyncSse( + {dynamic hint}); + Stream mirrorStructStreamTwinRustAsyncSse( {dynamic hint}); @@ -4282,6 +4295,10 @@ abstract class RustLibApi extends BaseApi { Future isAppEmbeddedTwinSse( {required ApplicationSettings appSettings, dynamic hint}); + Stream mirrorEnumStreamTwinSse({dynamic hint}); + + Stream mirrorOptionEnumStreamTwinSse({dynamic hint}); + Stream mirrorStructStreamTwinSse({dynamic hint}); Stream<(ApplicationSettings, RawStringEnumMirrored)> mirrorTupleStreamTwinSse( @@ -4333,6 +4350,10 @@ abstract class RustLibApi extends BaseApi { bool isAppEmbeddedTwinSync( {required ApplicationSettings appSettings, dynamic hint}); + Stream mirrorEnumStreamTwinSync({dynamic hint}); + + Stream mirrorOptionEnumStreamTwinSync({dynamic hint}); + Stream mirrorStructStreamTwinSync({dynamic hint}); Stream<(ApplicationSettings, RawStringEnumMirrored)> @@ -4383,6 +4404,10 @@ abstract class RustLibApi extends BaseApi { bool isAppEmbeddedTwinSyncSse( {required ApplicationSettings appSettings, dynamic hint}); + Stream mirrorEnumStreamTwinSyncSse({dynamic hint}); + + Stream mirrorOptionEnumStreamTwinSyncSse({dynamic hint}); + Stream mirrorStructStreamTwinSyncSse({dynamic hint}); Stream<(ApplicationSettings, RawStringEnumMirrored)> @@ -13407,6 +13432,51 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { argNames: ["appSettings"], ); + @override + Stream mirrorEnumStreamTwinNormal({dynamic hint}) { + return handler.executeStream(StreamTask( + callFfi: (port_) { + return wire.wire_mirror_enum_stream_twin_normal(port_); + }, + codec: DcoCodec( + decodeSuccessData: dco_decode_application_mode, + decodeErrorData: null, + ), + constMeta: kMirrorEnumStreamTwinNormalConstMeta, + argValues: [], + apiImpl: this, + hint: hint, + )); + } + + TaskConstMeta get kMirrorEnumStreamTwinNormalConstMeta => const TaskConstMeta( + debugName: "mirror_enum_stream_twin_normal", + argNames: [], + ); + + @override + Stream mirrorOptionEnumStreamTwinNormal({dynamic hint}) { + return handler.executeStream(StreamTask( + callFfi: (port_) { + return wire.wire_mirror_option_enum_stream_twin_normal(port_); + }, + codec: DcoCodec( + decodeSuccessData: dco_decode_opt_box_autoadd_application_mode, + decodeErrorData: null, + ), + constMeta: kMirrorOptionEnumStreamTwinNormalConstMeta, + argValues: [], + apiImpl: this, + hint: hint, + )); + } + + TaskConstMeta get kMirrorOptionEnumStreamTwinNormalConstMeta => + const TaskConstMeta( + debugName: "mirror_option_enum_stream_twin_normal", + argNames: [], + ); + @override Stream mirrorStructStreamTwinNormal({dynamic hint}) { return handler.executeStream(StreamTask( @@ -45180,6 +45250,52 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { argNames: ["appSettings"], ); + @override + Stream mirrorEnumStreamTwinRustAsync({dynamic hint}) { + return handler.executeStream(StreamTask( + callFfi: (port_) { + return wire.wire_mirror_enum_stream_twin_rust_async(port_); + }, + codec: DcoCodec( + decodeSuccessData: dco_decode_application_mode, + decodeErrorData: null, + ), + constMeta: kMirrorEnumStreamTwinRustAsyncConstMeta, + argValues: [], + apiImpl: this, + hint: hint, + )); + } + + TaskConstMeta get kMirrorEnumStreamTwinRustAsyncConstMeta => + const TaskConstMeta( + debugName: "mirror_enum_stream_twin_rust_async", + argNames: [], + ); + + @override + Stream mirrorOptionEnumStreamTwinRustAsync({dynamic hint}) { + return handler.executeStream(StreamTask( + callFfi: (port_) { + return wire.wire_mirror_option_enum_stream_twin_rust_async(port_); + }, + codec: DcoCodec( + decodeSuccessData: dco_decode_opt_box_autoadd_application_mode, + decodeErrorData: null, + ), + constMeta: kMirrorOptionEnumStreamTwinRustAsyncConstMeta, + argValues: [], + apiImpl: this, + hint: hint, + )); + } + + TaskConstMeta get kMirrorOptionEnumStreamTwinRustAsyncConstMeta => + const TaskConstMeta( + debugName: "mirror_option_enum_stream_twin_rust_async", + argNames: [], + ); + @override Stream mirrorStructStreamTwinRustAsync( {dynamic hint}) { @@ -45696,6 +45812,59 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { argNames: ["appSettings"], ); + @override + Stream mirrorEnumStreamTwinRustAsyncSse({dynamic hint}) { + return handler.executeStream(StreamTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + final raw_ = serializer.intoRaw(); + return wire.wire_mirror_enum_stream_twin_rust_async_sse( + port_, raw_.ptr, raw_.rustVecLen, raw_.dataLen); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_application_mode, + decodeErrorData: null, + ), + constMeta: kMirrorEnumStreamTwinRustAsyncSseConstMeta, + argValues: [], + apiImpl: this, + hint: hint, + )); + } + + TaskConstMeta get kMirrorEnumStreamTwinRustAsyncSseConstMeta => + const TaskConstMeta( + debugName: "mirror_enum_stream_twin_rust_async_sse", + argNames: [], + ); + + @override + Stream mirrorOptionEnumStreamTwinRustAsyncSse( + {dynamic hint}) { + return handler.executeStream(StreamTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + final raw_ = serializer.intoRaw(); + return wire.wire_mirror_option_enum_stream_twin_rust_async_sse( + port_, raw_.ptr, raw_.rustVecLen, raw_.dataLen); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_opt_box_autoadd_application_mode, + decodeErrorData: null, + ), + constMeta: kMirrorOptionEnumStreamTwinRustAsyncSseConstMeta, + argValues: [], + apiImpl: this, + hint: hint, + )); + } + + TaskConstMeta get kMirrorOptionEnumStreamTwinRustAsyncSseConstMeta => + const TaskConstMeta( + debugName: "mirror_option_enum_stream_twin_rust_async_sse", + argNames: [], + ); + @override Stream mirrorStructStreamTwinRustAsyncSse( {dynamic hint}) { @@ -46238,6 +46407,57 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { argNames: ["appSettings"], ); + @override + Stream mirrorEnumStreamTwinSse({dynamic hint}) { + return handler.executeStream(StreamTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + final raw_ = serializer.intoRaw(); + return wire.wire_mirror_enum_stream_twin_sse( + port_, raw_.ptr, raw_.rustVecLen, raw_.dataLen); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_application_mode, + decodeErrorData: null, + ), + constMeta: kMirrorEnumStreamTwinSseConstMeta, + argValues: [], + apiImpl: this, + hint: hint, + )); + } + + TaskConstMeta get kMirrorEnumStreamTwinSseConstMeta => const TaskConstMeta( + debugName: "mirror_enum_stream_twin_sse", + argNames: [], + ); + + @override + Stream mirrorOptionEnumStreamTwinSse({dynamic hint}) { + return handler.executeStream(StreamTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + final raw_ = serializer.intoRaw(); + return wire.wire_mirror_option_enum_stream_twin_sse( + port_, raw_.ptr, raw_.rustVecLen, raw_.dataLen); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_opt_box_autoadd_application_mode, + decodeErrorData: null, + ), + constMeta: kMirrorOptionEnumStreamTwinSseConstMeta, + argValues: [], + apiImpl: this, + hint: hint, + )); + } + + TaskConstMeta get kMirrorOptionEnumStreamTwinSseConstMeta => + const TaskConstMeta( + debugName: "mirror_option_enum_stream_twin_sse", + argNames: [], + ); + @override Stream mirrorStructStreamTwinSse({dynamic hint}) { return handler.executeStream(StreamTask( @@ -46745,6 +46965,51 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { argNames: ["appSettings"], ); + @override + Stream mirrorEnumStreamTwinSync({dynamic hint}) { + return handler.executeStream(StreamTask( + callFfi: (port_) { + return wire.wire_mirror_enum_stream_twin_sync(port_); + }, + codec: DcoCodec( + decodeSuccessData: dco_decode_application_mode, + decodeErrorData: null, + ), + constMeta: kMirrorEnumStreamTwinSyncConstMeta, + argValues: [], + apiImpl: this, + hint: hint, + )); + } + + TaskConstMeta get kMirrorEnumStreamTwinSyncConstMeta => const TaskConstMeta( + debugName: "mirror_enum_stream_twin_sync", + argNames: [], + ); + + @override + Stream mirrorOptionEnumStreamTwinSync({dynamic hint}) { + return handler.executeStream(StreamTask( + callFfi: (port_) { + return wire.wire_mirror_option_enum_stream_twin_sync(port_); + }, + codec: DcoCodec( + decodeSuccessData: dco_decode_opt_box_autoadd_application_mode, + decodeErrorData: null, + ), + constMeta: kMirrorOptionEnumStreamTwinSyncConstMeta, + argValues: [], + apiImpl: this, + hint: hint, + )); + } + + TaskConstMeta get kMirrorOptionEnumStreamTwinSyncConstMeta => + const TaskConstMeta( + debugName: "mirror_option_enum_stream_twin_sync", + argNames: [], + ); + @override Stream mirrorStructStreamTwinSync({dynamic hint}) { return handler.executeStream(StreamTask( @@ -47239,6 +47504,58 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { argNames: ["appSettings"], ); + @override + Stream mirrorEnumStreamTwinSyncSse({dynamic hint}) { + return handler.executeStream(StreamTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + final raw_ = serializer.intoRaw(); + return wire.wire_mirror_enum_stream_twin_sync_sse( + port_, raw_.ptr, raw_.rustVecLen, raw_.dataLen); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_application_mode, + decodeErrorData: null, + ), + constMeta: kMirrorEnumStreamTwinSyncSseConstMeta, + argValues: [], + apiImpl: this, + hint: hint, + )); + } + + TaskConstMeta get kMirrorEnumStreamTwinSyncSseConstMeta => + const TaskConstMeta( + debugName: "mirror_enum_stream_twin_sync_sse", + argNames: [], + ); + + @override + Stream mirrorOptionEnumStreamTwinSyncSse({dynamic hint}) { + return handler.executeStream(StreamTask( + callFfi: (port_) { + final serializer = SseSerializer(generalizedFrbRustBinding); + final raw_ = serializer.intoRaw(); + return wire.wire_mirror_option_enum_stream_twin_sync_sse( + port_, raw_.ptr, raw_.rustVecLen, raw_.dataLen); + }, + codec: SseCodec( + decodeSuccessData: sse_decode_opt_box_autoadd_application_mode, + decodeErrorData: null, + ), + constMeta: kMirrorOptionEnumStreamTwinSyncSseConstMeta, + argValues: [], + apiImpl: this, + hint: hint, + )); + } + + TaskConstMeta get kMirrorOptionEnumStreamTwinSyncSseConstMeta => + const TaskConstMeta( + debugName: "mirror_option_enum_stream_twin_sync_sse", + argNames: [], + ); + @override Stream mirrorStructStreamTwinSyncSse( {dynamic hint}) { @@ -82830,6 +83147,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return dco_decode_application_env(raw); } + @protected + ApplicationMode dco_decode_box_autoadd_application_mode(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_application_mode(raw); + } + @protected ApplicationSettings dco_decode_box_autoadd_application_settings(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -92372,6 +92695,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return raw == null ? null : dco_decode_box_autoadd_application_env(raw); } + @protected + ApplicationMode? dco_decode_opt_box_autoadd_application_mode(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw == null ? null : dco_decode_box_autoadd_application_mode(raw); + } + @protected AttributeTwinNormal? dco_decode_opt_box_autoadd_attribute_twin_normal( dynamic raw) { @@ -101508,6 +101837,13 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return (sse_decode_application_env(deserializer)); } + @protected + ApplicationMode sse_decode_box_autoadd_application_mode( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_application_mode(deserializer)); + } + @protected ApplicationSettings sse_decode_box_autoadd_application_settings( SseDeserializer deserializer) { @@ -112146,6 +112482,18 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { } } + @protected + ApplicationMode? sse_decode_opt_box_autoadd_application_mode( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + if (sse_decode_bool(deserializer)) { + return (sse_decode_box_autoadd_application_mode(deserializer)); + } else { + return null; + } + } + @protected AttributeTwinNormal? sse_decode_opt_box_autoadd_attribute_twin_normal( SseDeserializer deserializer) { @@ -122625,6 +122973,13 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { sse_encode_application_env(self, serializer); } + @protected + void sse_encode_box_autoadd_application_mode( + ApplicationMode self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_application_mode(self, serializer); + } + @protected void sse_encode_box_autoadd_application_settings( ApplicationSettings self, SseSerializer serializer) { @@ -131637,6 +131992,17 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { } } + @protected + void sse_encode_opt_box_autoadd_application_mode( + ApplicationMode? self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + sse_encode_bool(self != null, serializer); + if (self != null) { + sse_encode_box_autoadd_application_mode(self, serializer); + } + } + @protected void sse_encode_opt_box_autoadd_attribute_twin_normal( AttributeTwinNormal? self, SseSerializer serializer) { diff --git a/frb_example/pure_dart/lib/src/rust/frb_generated.io.dart b/frb_example/pure_dart/lib/src/rust/frb_generated.io.dart index b3126defd10..27691a6ceee 100644 --- a/frb_example/pure_dart/lib/src/rust/frb_generated.io.dart +++ b/frb_example/pure_dart/lib/src/rust/frb_generated.io.dart @@ -3549,6 +3549,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected ApplicationEnv dco_decode_box_autoadd_application_env(dynamic raw); + @protected + ApplicationMode dco_decode_box_autoadd_application_mode(dynamic raw); + @protected ApplicationSettings dco_decode_box_autoadd_application_settings(dynamic raw); @@ -7177,6 +7180,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected ApplicationEnv? dco_decode_opt_box_autoadd_application_env(dynamic raw); + @protected + ApplicationMode? dco_decode_opt_box_autoadd_application_mode(dynamic raw); + @protected AttributeTwinNormal? dco_decode_opt_box_autoadd_attribute_twin_normal( dynamic raw); @@ -11099,6 +11105,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { ApplicationEnv sse_decode_box_autoadd_application_env( SseDeserializer deserializer); + @protected + ApplicationMode sse_decode_box_autoadd_application_mode( + SseDeserializer deserializer); + @protected ApplicationSettings sse_decode_box_autoadd_application_settings( SseDeserializer deserializer); @@ -15239,6 +15249,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { ApplicationEnv? sse_decode_opt_box_autoadd_application_env( SseDeserializer deserializer); + @protected + ApplicationMode? sse_decode_opt_box_autoadd_application_mode( + SseDeserializer deserializer); + @protected AttributeTwinNormal? sse_decode_opt_box_autoadd_attribute_twin_normal( SseDeserializer deserializer); @@ -17380,6 +17394,14 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { return ptr; } + @protected + ffi.Pointer cst_encode_box_autoadd_application_mode( + ApplicationMode raw) { + // Codec=Cst (C-struct based), see doc to use other codecs + return wire + .cst_new_box_autoadd_application_mode(cst_encode_application_mode(raw)); + } + @protected ffi.Pointer cst_encode_box_autoadd_application_settings(ApplicationSettings raw) { @@ -21340,6 +21362,15 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { : cst_encode_box_autoadd_application_env(raw); } + @protected + ffi.Pointer cst_encode_opt_box_autoadd_application_mode( + ApplicationMode? raw) { + // Codec=Cst (C-struct based), see doc to use other codecs + return raw == null + ? ffi.nullptr + : cst_encode_box_autoadd_application_mode(raw); + } + @protected ffi.Pointer cst_encode_opt_box_autoadd_attribute_twin_normal( @@ -30462,6 +30493,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { void sse_encode_box_autoadd_application_env( ApplicationEnv self, SseSerializer serializer); + @protected + void sse_encode_box_autoadd_application_mode( + ApplicationMode self, SseSerializer serializer); + @protected void sse_encode_box_autoadd_application_settings( ApplicationSettings self, SseSerializer serializer); @@ -34383,6 +34418,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { void sse_encode_opt_box_autoadd_application_env( ApplicationEnv? self, SseSerializer serializer); + @protected + void sse_encode_opt_box_autoadd_application_mode( + ApplicationMode? self, SseSerializer serializer); + @protected void sse_encode_opt_box_autoadd_attribute_twin_normal( AttributeTwinNormal? self, SseSerializer serializer); @@ -38724,6 +38763,35 @@ class RustLibWire implements BaseWire { _wire_is_app_embedded_twin_normalPtr.asFunction< void Function(int, ffi.Pointer)>(); + void wire_mirror_enum_stream_twin_normal( + int port_, + ) { + return _wire_mirror_enum_stream_twin_normal( + port_, + ); + } + + late final _wire_mirror_enum_stream_twin_normalPtr = + _lookup>( + 'frbgen_frb_example_pure_dart_wire_mirror_enum_stream_twin_normal'); + late final _wire_mirror_enum_stream_twin_normal = + _wire_mirror_enum_stream_twin_normalPtr.asFunction(); + + void wire_mirror_option_enum_stream_twin_normal( + int port_, + ) { + return _wire_mirror_option_enum_stream_twin_normal( + port_, + ); + } + + late final _wire_mirror_option_enum_stream_twin_normalPtr = _lookup< + ffi.NativeFunction>( + 'frbgen_frb_example_pure_dart_wire_mirror_option_enum_stream_twin_normal'); + late final _wire_mirror_option_enum_stream_twin_normal = + _wire_mirror_option_enum_stream_twin_normalPtr + .asFunction(); + void wire_mirror_struct_stream_twin_normal( int port_, ) { @@ -62784,6 +62852,36 @@ class RustLibWire implements BaseWire { _wire_is_app_embedded_twin_rust_asyncPtr.asFunction< void Function(int, ffi.Pointer)>(); + void wire_mirror_enum_stream_twin_rust_async( + int port_, + ) { + return _wire_mirror_enum_stream_twin_rust_async( + port_, + ); + } + + late final _wire_mirror_enum_stream_twin_rust_asyncPtr = _lookup< + ffi.NativeFunction>( + 'frbgen_frb_example_pure_dart_wire_mirror_enum_stream_twin_rust_async'); + late final _wire_mirror_enum_stream_twin_rust_async = + _wire_mirror_enum_stream_twin_rust_asyncPtr + .asFunction(); + + void wire_mirror_option_enum_stream_twin_rust_async( + int port_, + ) { + return _wire_mirror_option_enum_stream_twin_rust_async( + port_, + ); + } + + late final _wire_mirror_option_enum_stream_twin_rust_asyncPtr = _lookup< + ffi.NativeFunction>( + 'frbgen_frb_example_pure_dart_wire_mirror_option_enum_stream_twin_rust_async'); + late final _wire_mirror_option_enum_stream_twin_rust_async = + _wire_mirror_option_enum_stream_twin_rust_asyncPtr + .asFunction(); + void wire_mirror_struct_stream_twin_rust_async( int port_, ) { @@ -63160,6 +63258,52 @@ class RustLibWire implements BaseWire { _wire_is_app_embedded_twin_rust_async_ssePtr .asFunction, int, int)>(); + void wire_mirror_enum_stream_twin_rust_async_sse( + int port_, + ffi.Pointer ptr_, + int rust_vec_len_, + int data_len_, + ) { + return _wire_mirror_enum_stream_twin_rust_async_sse( + port_, + ptr_, + rust_vec_len_, + data_len_, + ); + } + + late final _wire_mirror_enum_stream_twin_rust_async_ssePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, ffi.Pointer, ffi.Int32, ffi.Int32)>>( + 'frbgen_frb_example_pure_dart_wire_mirror_enum_stream_twin_rust_async_sse'); + late final _wire_mirror_enum_stream_twin_rust_async_sse = + _wire_mirror_enum_stream_twin_rust_async_ssePtr + .asFunction, int, int)>(); + + void wire_mirror_option_enum_stream_twin_rust_async_sse( + int port_, + ffi.Pointer ptr_, + int rust_vec_len_, + int data_len_, + ) { + return _wire_mirror_option_enum_stream_twin_rust_async_sse( + port_, + ptr_, + rust_vec_len_, + data_len_, + ); + } + + late final _wire_mirror_option_enum_stream_twin_rust_async_ssePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, ffi.Pointer, ffi.Int32, ffi.Int32)>>( + 'frbgen_frb_example_pure_dart_wire_mirror_option_enum_stream_twin_rust_async_sse'); + late final _wire_mirror_option_enum_stream_twin_rust_async_sse = + _wire_mirror_option_enum_stream_twin_rust_async_ssePtr + .asFunction, int, int)>(); + void wire_mirror_struct_stream_twin_rust_async_sse( int port_, ffi.Pointer ptr_, @@ -63621,6 +63765,52 @@ class RustLibWire implements BaseWire { late final _wire_is_app_embedded_twin_sse = _wire_is_app_embedded_twin_ssePtr .asFunction, int, int)>(); + void wire_mirror_enum_stream_twin_sse( + int port_, + ffi.Pointer ptr_, + int rust_vec_len_, + int data_len_, + ) { + return _wire_mirror_enum_stream_twin_sse( + port_, + ptr_, + rust_vec_len_, + data_len_, + ); + } + + late final _wire_mirror_enum_stream_twin_ssePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, ffi.Pointer, ffi.Int32, ffi.Int32)>>( + 'frbgen_frb_example_pure_dart_wire_mirror_enum_stream_twin_sse'); + late final _wire_mirror_enum_stream_twin_sse = + _wire_mirror_enum_stream_twin_ssePtr + .asFunction, int, int)>(); + + void wire_mirror_option_enum_stream_twin_sse( + int port_, + ffi.Pointer ptr_, + int rust_vec_len_, + int data_len_, + ) { + return _wire_mirror_option_enum_stream_twin_sse( + port_, + ptr_, + rust_vec_len_, + data_len_, + ); + } + + late final _wire_mirror_option_enum_stream_twin_ssePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, ffi.Pointer, ffi.Int32, ffi.Int32)>>( + 'frbgen_frb_example_pure_dart_wire_mirror_option_enum_stream_twin_sse'); + late final _wire_mirror_option_enum_stream_twin_sse = + _wire_mirror_option_enum_stream_twin_ssePtr + .asFunction, int, int)>(); + void wire_mirror_struct_stream_twin_sse( int port_, ffi.Pointer ptr_, @@ -64006,6 +64196,35 @@ class RustLibWire implements BaseWire { WireSyncRust2DartDco Function( ffi.Pointer)>(); + void wire_mirror_enum_stream_twin_sync( + int port_, + ) { + return _wire_mirror_enum_stream_twin_sync( + port_, + ); + } + + late final _wire_mirror_enum_stream_twin_syncPtr = + _lookup>( + 'frbgen_frb_example_pure_dart_wire_mirror_enum_stream_twin_sync'); + late final _wire_mirror_enum_stream_twin_sync = + _wire_mirror_enum_stream_twin_syncPtr.asFunction(); + + void wire_mirror_option_enum_stream_twin_sync( + int port_, + ) { + return _wire_mirror_option_enum_stream_twin_sync( + port_, + ); + } + + late final _wire_mirror_option_enum_stream_twin_syncPtr = _lookup< + ffi.NativeFunction>( + 'frbgen_frb_example_pure_dart_wire_mirror_option_enum_stream_twin_sync'); + late final _wire_mirror_option_enum_stream_twin_sync = + _wire_mirror_option_enum_stream_twin_syncPtr + .asFunction(); + void wire_mirror_struct_stream_twin_sync( int port_, ) { @@ -64334,6 +64553,52 @@ class RustLibWire implements BaseWire { _wire_is_app_embedded_twin_sync_ssePtr.asFunction< WireSyncRust2DartSse Function(ffi.Pointer, int, int)>(); + void wire_mirror_enum_stream_twin_sync_sse( + int port_, + ffi.Pointer ptr_, + int rust_vec_len_, + int data_len_, + ) { + return _wire_mirror_enum_stream_twin_sync_sse( + port_, + ptr_, + rust_vec_len_, + data_len_, + ); + } + + late final _wire_mirror_enum_stream_twin_sync_ssePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, ffi.Pointer, ffi.Int32, ffi.Int32)>>( + 'frbgen_frb_example_pure_dart_wire_mirror_enum_stream_twin_sync_sse'); + late final _wire_mirror_enum_stream_twin_sync_sse = + _wire_mirror_enum_stream_twin_sync_ssePtr + .asFunction, int, int)>(); + + void wire_mirror_option_enum_stream_twin_sync_sse( + int port_, + ffi.Pointer ptr_, + int rust_vec_len_, + int data_len_, + ) { + return _wire_mirror_option_enum_stream_twin_sync_sse( + port_, + ptr_, + rust_vec_len_, + data_len_, + ); + } + + late final _wire_mirror_option_enum_stream_twin_sync_ssePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int64, ffi.Pointer, ffi.Int32, ffi.Int32)>>( + 'frbgen_frb_example_pure_dart_wire_mirror_option_enum_stream_twin_sync_sse'); + late final _wire_mirror_option_enum_stream_twin_sync_sse = + _wire_mirror_option_enum_stream_twin_sync_ssePtr + .asFunction, int, int)>(); + void wire_mirror_struct_stream_twin_sync_sse( int port_, ffi.Pointer ptr_, @@ -91083,6 +91348,21 @@ class RustLibWire implements BaseWire { _cst_new_box_autoadd_application_envPtr .asFunction Function()>(); + ffi.Pointer cst_new_box_autoadd_application_mode( + int value, + ) { + return _cst_new_box_autoadd_application_mode( + value, + ); + } + + late final _cst_new_box_autoadd_application_modePtr = + _lookup Function(ffi.Int32)>>( + 'frbgen_frb_example_pure_dart_cst_new_box_autoadd_application_mode'); + late final _cst_new_box_autoadd_application_mode = + _cst_new_box_autoadd_application_modePtr + .asFunction Function(int)>(); + ffi.Pointer cst_new_box_autoadd_application_settings() { return _cst_new_box_autoadd_application_settings(); diff --git a/frb_example/pure_dart/lib/src/rust/frb_generated.web.dart b/frb_example/pure_dart/lib/src/rust/frb_generated.web.dart index 7ab32b31715..d225656ba6e 100644 --- a/frb_example/pure_dart/lib/src/rust/frb_generated.web.dart +++ b/frb_example/pure_dart/lib/src/rust/frb_generated.web.dart @@ -3548,6 +3548,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected ApplicationEnv dco_decode_box_autoadd_application_env(dynamic raw); + @protected + ApplicationMode dco_decode_box_autoadd_application_mode(dynamic raw); + @protected ApplicationSettings dco_decode_box_autoadd_application_settings(dynamic raw); @@ -7176,6 +7179,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected ApplicationEnv? dco_decode_opt_box_autoadd_application_env(dynamic raw); + @protected + ApplicationMode? dco_decode_opt_box_autoadd_application_mode(dynamic raw); + @protected AttributeTwinNormal? dco_decode_opt_box_autoadd_attribute_twin_normal( dynamic raw); @@ -11098,6 +11104,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { ApplicationEnv sse_decode_box_autoadd_application_env( SseDeserializer deserializer); + @protected + ApplicationMode sse_decode_box_autoadd_application_mode( + SseDeserializer deserializer); + @protected ApplicationSettings sse_decode_box_autoadd_application_settings( SseDeserializer deserializer); @@ -15238,6 +15248,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { ApplicationEnv? sse_decode_opt_box_autoadd_application_env( SseDeserializer deserializer); + @protected + ApplicationMode? sse_decode_opt_box_autoadd_application_mode( + SseDeserializer deserializer); + @protected AttributeTwinNormal? sse_decode_opt_box_autoadd_attribute_twin_normal( SseDeserializer deserializer); @@ -17649,6 +17663,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { return cst_encode_application_env(raw); } + @protected + int cst_encode_box_autoadd_application_mode(ApplicationMode raw) { + // Codec=Cst (C-struct based), see doc to use other codecs + return cst_encode_application_mode(raw); + } + @protected List cst_encode_box_autoadd_application_settings( ApplicationSettings raw) { @@ -22103,6 +22123,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { return raw == null ? null : cst_encode_box_autoadd_application_env(raw); } + @protected + int? cst_encode_opt_box_autoadd_application_mode(ApplicationMode? raw) { + // Codec=Cst (C-struct based), see doc to use other codecs + return raw == null ? null : cst_encode_box_autoadd_application_mode(raw); + } + @protected List? cst_encode_opt_box_autoadd_attribute_twin_normal( AttributeTwinNormal? raw) { @@ -27328,6 +27354,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { void sse_encode_box_autoadd_application_env( ApplicationEnv self, SseSerializer serializer); + @protected + void sse_encode_box_autoadd_application_mode( + ApplicationMode self, SseSerializer serializer); + @protected void sse_encode_box_autoadd_application_settings( ApplicationSettings self, SseSerializer serializer); @@ -31249,6 +31279,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { void sse_encode_opt_box_autoadd_application_env( ApplicationEnv? self, SseSerializer serializer); + @protected + void sse_encode_opt_box_autoadd_application_mode( + ApplicationMode? self, SseSerializer serializer); + @protected void sse_encode_opt_box_autoadd_attribute_twin_normal( AttributeTwinNormal? self, SseSerializer serializer); @@ -33292,6 +33326,12 @@ class RustLibWire implements BaseWire { NativePortType port_, List app_settings) => wasmModule.wire_is_app_embedded_twin_normal(port_, app_settings); + void wire_mirror_enum_stream_twin_normal(NativePortType port_) => + wasmModule.wire_mirror_enum_stream_twin_normal(port_); + + void wire_mirror_option_enum_stream_twin_normal(NativePortType port_) => + wasmModule.wire_mirror_option_enum_stream_twin_normal(port_); + void wire_mirror_struct_stream_twin_normal(NativePortType port_) => wasmModule.wire_mirror_struct_stream_twin_normal(port_); @@ -40662,6 +40702,12 @@ class RustLibWire implements BaseWire { NativePortType port_, List app_settings) => wasmModule.wire_is_app_embedded_twin_rust_async(port_, app_settings); + void wire_mirror_enum_stream_twin_rust_async(NativePortType port_) => + wasmModule.wire_mirror_enum_stream_twin_rust_async(port_); + + void wire_mirror_option_enum_stream_twin_rust_async(NativePortType port_) => + wasmModule.wire_mirror_option_enum_stream_twin_rust_async(port_); + void wire_mirror_struct_stream_twin_rust_async(NativePortType port_) => wasmModule.wire_mirror_struct_stream_twin_rust_async(port_); @@ -40774,6 +40820,22 @@ class RustLibWire implements BaseWire { wasmModule.wire_is_app_embedded_twin_rust_async_sse( port_, ptr_, rust_vec_len_, data_len_); + void wire_mirror_enum_stream_twin_rust_async_sse( + NativePortType port_, + PlatformGeneralizedUint8ListPtr ptr_, + int rust_vec_len_, + int data_len_) => + wasmModule.wire_mirror_enum_stream_twin_rust_async_sse( + port_, ptr_, rust_vec_len_, data_len_); + + void wire_mirror_option_enum_stream_twin_rust_async_sse( + NativePortType port_, + PlatformGeneralizedUint8ListPtr ptr_, + int rust_vec_len_, + int data_len_) => + wasmModule.wire_mirror_option_enum_stream_twin_rust_async_sse( + port_, ptr_, rust_vec_len_, data_len_); + void wire_mirror_struct_stream_twin_rust_async_sse( NativePortType port_, PlatformGeneralizedUint8ListPtr ptr_, @@ -40935,6 +40997,22 @@ class RustLibWire implements BaseWire { wasmModule.wire_is_app_embedded_twin_sse( port_, ptr_, rust_vec_len_, data_len_); + void wire_mirror_enum_stream_twin_sse( + NativePortType port_, + PlatformGeneralizedUint8ListPtr ptr_, + int rust_vec_len_, + int data_len_) => + wasmModule.wire_mirror_enum_stream_twin_sse( + port_, ptr_, rust_vec_len_, data_len_); + + void wire_mirror_option_enum_stream_twin_sse( + NativePortType port_, + PlatformGeneralizedUint8ListPtr ptr_, + int rust_vec_len_, + int data_len_) => + wasmModule.wire_mirror_option_enum_stream_twin_sse( + port_, ptr_, rust_vec_len_, data_len_); + void wire_mirror_struct_stream_twin_sse( NativePortType port_, PlatformGeneralizedUint8ListPtr ptr_, @@ -41060,6 +41138,12 @@ class RustLibWire implements BaseWire { wire_is_app_embedded_twin_sync(List app_settings) => wasmModule.wire_is_app_embedded_twin_sync(app_settings); + void wire_mirror_enum_stream_twin_sync(NativePortType port_) => + wasmModule.wire_mirror_enum_stream_twin_sync(port_); + + void wire_mirror_option_enum_stream_twin_sync(NativePortType port_) => + wasmModule.wire_mirror_option_enum_stream_twin_sync(port_); + void wire_mirror_struct_stream_twin_sync(NativePortType port_) => wasmModule.wire_mirror_struct_stream_twin_sync(port_); @@ -41160,6 +41244,22 @@ class RustLibWire implements BaseWire { wasmModule.wire_is_app_embedded_twin_sync_sse( ptr_, rust_vec_len_, data_len_); + void wire_mirror_enum_stream_twin_sync_sse( + NativePortType port_, + PlatformGeneralizedUint8ListPtr ptr_, + int rust_vec_len_, + int data_len_) => + wasmModule.wire_mirror_enum_stream_twin_sync_sse( + port_, ptr_, rust_vec_len_, data_len_); + + void wire_mirror_option_enum_stream_twin_sync_sse( + NativePortType port_, + PlatformGeneralizedUint8ListPtr ptr_, + int rust_vec_len_, + int data_len_) => + wasmModule.wire_mirror_option_enum_stream_twin_sync_sse( + port_, ptr_, rust_vec_len_, data_len_); + void wire_mirror_struct_stream_twin_sync_sse( NativePortType port_, PlatformGeneralizedUint8ListPtr ptr_, @@ -50312,6 +50412,11 @@ class RustLibWasmModule implements WasmModule { external void wire_is_app_embedded_twin_normal( NativePortType port_, List app_settings); + external void wire_mirror_enum_stream_twin_normal(NativePortType port_); + + external void wire_mirror_option_enum_stream_twin_normal( + NativePortType port_); + external void wire_mirror_struct_stream_twin_normal(NativePortType port_); external void wire_mirror_tuple_stream_twin_normal(NativePortType port_); @@ -55209,6 +55314,11 @@ class RustLibWasmModule implements WasmModule { external void wire_is_app_embedded_twin_rust_async( NativePortType port_, List app_settings); + external void wire_mirror_enum_stream_twin_rust_async(NativePortType port_); + + external void wire_mirror_option_enum_stream_twin_rust_async( + NativePortType port_); + external void wire_mirror_struct_stream_twin_rust_async(NativePortType port_); external void wire_mirror_tuple_stream_twin_rust_async(NativePortType port_); @@ -55276,6 +55386,18 @@ class RustLibWasmModule implements WasmModule { external void wire_is_app_embedded_twin_rust_async_sse(NativePortType port_, PlatformGeneralizedUint8ListPtr ptr_, int rust_vec_len_, int data_len_); + external void wire_mirror_enum_stream_twin_rust_async_sse( + NativePortType port_, + PlatformGeneralizedUint8ListPtr ptr_, + int rust_vec_len_, + int data_len_); + + external void wire_mirror_option_enum_stream_twin_rust_async_sse( + NativePortType port_, + PlatformGeneralizedUint8ListPtr ptr_, + int rust_vec_len_, + int data_len_); + external void wire_mirror_struct_stream_twin_rust_async_sse( NativePortType port_, PlatformGeneralizedUint8ListPtr ptr_, @@ -55367,6 +55489,12 @@ class RustLibWasmModule implements WasmModule { external void wire_is_app_embedded_twin_sse(NativePortType port_, PlatformGeneralizedUint8ListPtr ptr_, int rust_vec_len_, int data_len_); + external void wire_mirror_enum_stream_twin_sse(NativePortType port_, + PlatformGeneralizedUint8ListPtr ptr_, int rust_vec_len_, int data_len_); + + external void wire_mirror_option_enum_stream_twin_sse(NativePortType port_, + PlatformGeneralizedUint8ListPtr ptr_, int rust_vec_len_, int data_len_); + external void wire_mirror_struct_stream_twin_sse(NativePortType port_, PlatformGeneralizedUint8ListPtr ptr_, int rust_vec_len_, int data_len_); @@ -55446,6 +55574,10 @@ class RustLibWasmModule implements WasmModule { external dynamic /* flutter_rust_bridge::for_generated::WireSyncRust2DartDco */ wire_is_app_embedded_twin_sync(List app_settings); + external void wire_mirror_enum_stream_twin_sync(NativePortType port_); + + external void wire_mirror_option_enum_stream_twin_sync(NativePortType port_); + external void wire_mirror_struct_stream_twin_sync(NativePortType port_); external void wire_mirror_tuple_stream_twin_sync(NativePortType port_); @@ -55512,6 +55644,15 @@ class RustLibWasmModule implements WasmModule { wire_is_app_embedded_twin_sync_sse(PlatformGeneralizedUint8ListPtr ptr_, int rust_vec_len_, int data_len_); + external void wire_mirror_enum_stream_twin_sync_sse(NativePortType port_, + PlatformGeneralizedUint8ListPtr ptr_, int rust_vec_len_, int data_len_); + + external void wire_mirror_option_enum_stream_twin_sync_sse( + NativePortType port_, + PlatformGeneralizedUint8ListPtr ptr_, + int rust_vec_len_, + int data_len_); + external void wire_mirror_struct_stream_twin_sync_sse(NativePortType port_, PlatformGeneralizedUint8ListPtr ptr_, int rust_vec_len_, int data_len_); diff --git a/frb_example/pure_dart/rust/src/api/mirror.rs b/frb_example/pure_dart/rust/src/api/mirror.rs index cc2f37189a0..485cc45d2e2 100644 --- a/frb_example/pure_dart/rust/src/api/mirror.rs +++ b/frb_example/pure_dart/rust/src/api/mirror.rs @@ -260,3 +260,14 @@ pub fn test_hashmap_with_mirrored_value_twin_normal() -> StructWithHashMap { }, } } + +pub fn mirror_enum_stream_twin_normal(sink: StreamSink) { + sink.add(ApplicationMode::Embedded).unwrap(); + sink.add(ApplicationMode::Standalone).unwrap(); +} + +pub fn mirror_option_enum_stream_twin_normal(sink: StreamSink>) { + sink.add(Some(ApplicationMode::Embedded)).unwrap(); + sink.add(None).unwrap(); + sink.add(Some(ApplicationMode::Standalone)).unwrap(); +} diff --git a/frb_example/pure_dart/rust/src/api/pseudo_manual/mirror_twin_rust_async.rs b/frb_example/pure_dart/rust/src/api/pseudo_manual/mirror_twin_rust_async.rs index 11c55a3d10e..c29cbaba2d7 100644 --- a/frb_example/pure_dart/rust/src/api/pseudo_manual/mirror_twin_rust_async.rs +++ b/frb_example/pure_dart/rust/src/api/pseudo_manual/mirror_twin_rust_async.rs @@ -266,3 +266,14 @@ pub async fn test_hashmap_with_mirrored_value_twin_rust_async() -> StructWithHas }, } } + +pub async fn mirror_enum_stream_twin_rust_async(sink: StreamSink) { + sink.add(ApplicationMode::Embedded).unwrap(); + sink.add(ApplicationMode::Standalone).unwrap(); +} + +pub async fn mirror_option_enum_stream_twin_rust_async(sink: StreamSink>) { + sink.add(Some(ApplicationMode::Embedded)).unwrap(); + sink.add(None).unwrap(); + sink.add(Some(ApplicationMode::Standalone)).unwrap(); +} diff --git a/frb_example/pure_dart/rust/src/api/pseudo_manual/mirror_twin_rust_async_sse.rs b/frb_example/pure_dart/rust/src/api/pseudo_manual/mirror_twin_rust_async_sse.rs index f03399e3b7b..470169defc5 100644 --- a/frb_example/pure_dart/rust/src/api/pseudo_manual/mirror_twin_rust_async_sse.rs +++ b/frb_example/pure_dart/rust/src/api/pseudo_manual/mirror_twin_rust_async_sse.rs @@ -296,3 +296,20 @@ pub async fn test_hashmap_with_mirrored_value_twin_rust_async_sse() -> StructWit }, } } + +#[flutter_rust_bridge::frb(serialize)] +pub async fn mirror_enum_stream_twin_rust_async_sse( + sink: StreamSink, +) { + sink.add(ApplicationMode::Embedded).unwrap(); + sink.add(ApplicationMode::Standalone).unwrap(); +} + +#[flutter_rust_bridge::frb(serialize)] +pub async fn mirror_option_enum_stream_twin_rust_async_sse( + sink: StreamSink, flutter_rust_bridge::SseCodec>, +) { + sink.add(Some(ApplicationMode::Embedded)).unwrap(); + sink.add(None).unwrap(); + sink.add(Some(ApplicationMode::Standalone)).unwrap(); +} diff --git a/frb_example/pure_dart/rust/src/api/pseudo_manual/mirror_twin_sse.rs b/frb_example/pure_dart/rust/src/api/pseudo_manual/mirror_twin_sse.rs index d7afa5de41c..2da2e621eb1 100644 --- a/frb_example/pure_dart/rust/src/api/pseudo_manual/mirror_twin_sse.rs +++ b/frb_example/pure_dart/rust/src/api/pseudo_manual/mirror_twin_sse.rs @@ -289,3 +289,20 @@ pub fn test_hashmap_with_mirrored_value_twin_sse() -> StructWithHashMap { }, } } + +#[flutter_rust_bridge::frb(serialize)] +pub fn mirror_enum_stream_twin_sse( + sink: StreamSink, +) { + sink.add(ApplicationMode::Embedded).unwrap(); + sink.add(ApplicationMode::Standalone).unwrap(); +} + +#[flutter_rust_bridge::frb(serialize)] +pub fn mirror_option_enum_stream_twin_sse( + sink: StreamSink, flutter_rust_bridge::SseCodec>, +) { + sink.add(Some(ApplicationMode::Embedded)).unwrap(); + sink.add(None).unwrap(); + sink.add(Some(ApplicationMode::Standalone)).unwrap(); +} diff --git a/frb_example/pure_dart/rust/src/api/pseudo_manual/mirror_twin_sync.rs b/frb_example/pure_dart/rust/src/api/pseudo_manual/mirror_twin_sync.rs index e52ceca940c..c1fd313a219 100644 --- a/frb_example/pure_dart/rust/src/api/pseudo_manual/mirror_twin_sync.rs +++ b/frb_example/pure_dart/rust/src/api/pseudo_manual/mirror_twin_sync.rs @@ -283,3 +283,16 @@ pub fn test_hashmap_with_mirrored_value_twin_sync() -> StructWithHashMap { }, } } + +#[flutter_rust_bridge::frb(sync)] +pub fn mirror_enum_stream_twin_sync(sink: StreamSink) { + sink.add(ApplicationMode::Embedded).unwrap(); + sink.add(ApplicationMode::Standalone).unwrap(); +} + +#[flutter_rust_bridge::frb(sync)] +pub fn mirror_option_enum_stream_twin_sync(sink: StreamSink>) { + sink.add(Some(ApplicationMode::Embedded)).unwrap(); + sink.add(None).unwrap(); + sink.add(Some(ApplicationMode::Standalone)).unwrap(); +} diff --git a/frb_example/pure_dart/rust/src/api/pseudo_manual/mirror_twin_sync_sse.rs b/frb_example/pure_dart/rust/src/api/pseudo_manual/mirror_twin_sync_sse.rs index c4383ed2b75..f6995cd8f47 100644 --- a/frb_example/pure_dart/rust/src/api/pseudo_manual/mirror_twin_sync_sse.rs +++ b/frb_example/pure_dart/rust/src/api/pseudo_manual/mirror_twin_sync_sse.rs @@ -310,3 +310,22 @@ pub fn test_hashmap_with_mirrored_value_twin_sync_sse() -> StructWithHashMap { }, } } + +#[flutter_rust_bridge::frb(serialize)] +#[flutter_rust_bridge::frb(sync)] +pub fn mirror_enum_stream_twin_sync_sse( + sink: StreamSink, +) { + sink.add(ApplicationMode::Embedded).unwrap(); + sink.add(ApplicationMode::Standalone).unwrap(); +} + +#[flutter_rust_bridge::frb(serialize)] +#[flutter_rust_bridge::frb(sync)] +pub fn mirror_option_enum_stream_twin_sync_sse( + sink: StreamSink, flutter_rust_bridge::SseCodec>, +) { + sink.add(Some(ApplicationMode::Embedded)).unwrap(); + sink.add(None).unwrap(); + sink.add(Some(ApplicationMode::Standalone)).unwrap(); +} diff --git a/frb_example/pure_dart/rust/src/frb_generated.io.rs b/frb_example/pure_dart/rust/src/frb_generated.io.rs index c79e059ebe6..877e2c999d3 100644 --- a/frb_example/pure_dart/rust/src/frb_generated.io.rs +++ b/frb_example/pure_dart/rust/src/frb_generated.io.rs @@ -3216,6 +3216,16 @@ impl CstDecode .into() } } +impl CstDecode for *mut i32 { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> crate::api::pseudo_manual::mirror_twin_sync_sse::ApplicationMode { + let wrap = unsafe { flutter_rust_bridge::for_generated::box_from_leak_ptr(self) }; + CstDecode::::cst_decode( + *wrap, + ) + .into() + } +} impl CstDecode for *mut wire_cst_application_settings { @@ -16005,6 +16015,18 @@ pub extern "C" fn frbgen_frb_example_pure_dart_wire_is_app_embedded_twin_normal( wire_is_app_embedded_twin_normal_impl(port_, app_settings) } +#[no_mangle] +pub extern "C" fn frbgen_frb_example_pure_dart_wire_mirror_enum_stream_twin_normal(port_: i64) { + wire_mirror_enum_stream_twin_normal_impl(port_) +} + +#[no_mangle] +pub extern "C" fn frbgen_frb_example_pure_dart_wire_mirror_option_enum_stream_twin_normal( + port_: i64, +) { + wire_mirror_option_enum_stream_twin_normal_impl(port_) +} + #[no_mangle] pub extern "C" fn frbgen_frb_example_pure_dart_wire_mirror_struct_stream_twin_normal(port_: i64) { wire_mirror_struct_stream_twin_normal_impl(port_) @@ -26880,6 +26902,18 @@ pub extern "C" fn frbgen_frb_example_pure_dart_wire_is_app_embedded_twin_rust_as wire_is_app_embedded_twin_rust_async_impl(port_, app_settings) } +#[no_mangle] +pub extern "C" fn frbgen_frb_example_pure_dart_wire_mirror_enum_stream_twin_rust_async(port_: i64) { + wire_mirror_enum_stream_twin_rust_async_impl(port_) +} + +#[no_mangle] +pub extern "C" fn frbgen_frb_example_pure_dart_wire_mirror_option_enum_stream_twin_rust_async( + port_: i64, +) { + wire_mirror_option_enum_stream_twin_rust_async_impl(port_) +} + #[no_mangle] pub extern "C" fn frbgen_frb_example_pure_dart_wire_mirror_struct_stream_twin_rust_async( port_: i64, @@ -27049,6 +27083,26 @@ pub extern "C" fn frbgen_frb_example_pure_dart_wire_is_app_embedded_twin_rust_as wire_is_app_embedded_twin_rust_async_sse_impl(port_, ptr_, rust_vec_len_, data_len_) } +#[no_mangle] +pub extern "C" fn frbgen_frb_example_pure_dart_wire_mirror_enum_stream_twin_rust_async_sse( + port_: i64, + ptr_: *mut u8, + rust_vec_len_: i32, + data_len_: i32, +) { + wire_mirror_enum_stream_twin_rust_async_sse_impl(port_, ptr_, rust_vec_len_, data_len_) +} + +#[no_mangle] +pub extern "C" fn frbgen_frb_example_pure_dart_wire_mirror_option_enum_stream_twin_rust_async_sse( + port_: i64, + ptr_: *mut u8, + rust_vec_len_: i32, + data_len_: i32, +) { + wire_mirror_option_enum_stream_twin_rust_async_sse_impl(port_, ptr_, rust_vec_len_, data_len_) +} + #[no_mangle] pub extern "C" fn frbgen_frb_example_pure_dart_wire_mirror_struct_stream_twin_rust_async_sse( port_: i64, @@ -27284,6 +27338,26 @@ pub extern "C" fn frbgen_frb_example_pure_dart_wire_is_app_embedded_twin_sse( wire_is_app_embedded_twin_sse_impl(port_, ptr_, rust_vec_len_, data_len_) } +#[no_mangle] +pub extern "C" fn frbgen_frb_example_pure_dart_wire_mirror_enum_stream_twin_sse( + port_: i64, + ptr_: *mut u8, + rust_vec_len_: i32, + data_len_: i32, +) { + wire_mirror_enum_stream_twin_sse_impl(port_, ptr_, rust_vec_len_, data_len_) +} + +#[no_mangle] +pub extern "C" fn frbgen_frb_example_pure_dart_wire_mirror_option_enum_stream_twin_sse( + port_: i64, + ptr_: *mut u8, + rust_vec_len_: i32, + data_len_: i32, +) { + wire_mirror_option_enum_stream_twin_sse_impl(port_, ptr_, rust_vec_len_, data_len_) +} + #[no_mangle] pub extern "C" fn frbgen_frb_example_pure_dart_wire_mirror_struct_stream_twin_sse( port_: i64, @@ -27458,6 +27532,18 @@ pub extern "C" fn frbgen_frb_example_pure_dart_wire_is_app_embedded_twin_sync( wire_is_app_embedded_twin_sync_impl(app_settings) } +#[no_mangle] +pub extern "C" fn frbgen_frb_example_pure_dart_wire_mirror_enum_stream_twin_sync(port_: i64) { + wire_mirror_enum_stream_twin_sync_impl(port_) +} + +#[no_mangle] +pub extern "C" fn frbgen_frb_example_pure_dart_wire_mirror_option_enum_stream_twin_sync( + port_: i64, +) { + wire_mirror_option_enum_stream_twin_sync_impl(port_) +} + #[no_mangle] pub extern "C" fn frbgen_frb_example_pure_dart_wire_mirror_struct_stream_twin_sync(port_: i64) { wire_mirror_struct_stream_twin_sync_impl(port_) @@ -27607,6 +27693,26 @@ pub extern "C" fn frbgen_frb_example_pure_dart_wire_is_app_embedded_twin_sync_ss wire_is_app_embedded_twin_sync_sse_impl(ptr_, rust_vec_len_, data_len_) } +#[no_mangle] +pub extern "C" fn frbgen_frb_example_pure_dart_wire_mirror_enum_stream_twin_sync_sse( + port_: i64, + ptr_: *mut u8, + rust_vec_len_: i32, + data_len_: i32, +) { + wire_mirror_enum_stream_twin_sync_sse_impl(port_, ptr_, rust_vec_len_, data_len_) +} + +#[no_mangle] +pub extern "C" fn frbgen_frb_example_pure_dart_wire_mirror_option_enum_stream_twin_sync_sse( + port_: i64, + ptr_: *mut u8, + rust_vec_len_: i32, + data_len_: i32, +) { + wire_mirror_option_enum_stream_twin_sync_sse_impl(port_, ptr_, rust_vec_len_, data_len_) +} + #[no_mangle] pub extern "C" fn frbgen_frb_example_pure_dart_wire_mirror_struct_stream_twin_sync_sse( port_: i64, @@ -40810,6 +40916,13 @@ pub extern "C" fn frbgen_frb_example_pure_dart_cst_new_box_autoadd_application_e ) } +#[no_mangle] +pub extern "C" fn frbgen_frb_example_pure_dart_cst_new_box_autoadd_application_mode( + value: i32, +) -> *mut i32 { + flutter_rust_bridge::for_generated::new_leak_box_ptr(value) +} + #[no_mangle] pub extern "C" fn frbgen_frb_example_pure_dart_cst_new_box_autoadd_application_settings( ) -> *mut wire_cst_application_settings { diff --git a/frb_example/pure_dart/rust/src/frb_generated.rs b/frb_example/pure_dart/rust/src/frb_generated.rs index 373801ca756..2a93b9e4ab8 100644 --- a/frb_example/pure_dart/rust/src/frb_generated.rs +++ b/frb_example/pure_dart/rust/src/frb_generated.rs @@ -3218,6 +3218,54 @@ fn wire_is_app_embedded_twin_normal_impl( }, ) } +fn wire_mirror_enum_stream_twin_normal_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "mirror_enum_stream_twin_normal", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Stream, + }, + move || { + move |context| { + transform_result_dco((move || { + Result::<_, ()>::Ok(crate::api::mirror::mirror_enum_stream_twin_normal( + StreamSink::new( + context + .rust2dart_context() + .stream_sink::<_, mirror_ApplicationMode>(), + ), + )) + })()) + } + }, + ) +} +fn wire_mirror_option_enum_stream_twin_normal_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "mirror_option_enum_stream_twin_normal", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Stream, + }, + move || { + move |context| { + transform_result_dco((move || { + Result::<_, ()>::Ok(crate::api::mirror::mirror_option_enum_stream_twin_normal( + StreamSink::new( + context + .rust2dart_context() + .stream_sink::<_, Option>(), + ), + )) + })()) + } + }, + ) +} fn wire_mirror_struct_stream_twin_normal_impl( port_: flutter_rust_bridge::for_generated::MessagePort, ) { @@ -20417,6 +20465,24 @@ fn wire_is_app_embedded_twin_rust_async_impl( })().await) } }) } +fn wire_mirror_enum_stream_twin_rust_async_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::(flutter_rust_bridge::for_generated::TaskInfo{ debug_name: "mirror_enum_stream_twin_rust_async", port: Some(port_), mode: flutter_rust_bridge::for_generated::FfiCallMode::Stream }, move || { move |context| async move { + transform_result_dco((move || async move { + Result::<_,()>::Ok(crate::api::pseudo_manual::mirror_twin_rust_async::mirror_enum_stream_twin_rust_async(StreamSink::new(context.rust2dart_context().stream_sink::<_,mirror_ApplicationMode>())).await) + })().await) + } }) +} +fn wire_mirror_option_enum_stream_twin_rust_async_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::(flutter_rust_bridge::for_generated::TaskInfo{ debug_name: "mirror_option_enum_stream_twin_rust_async", port: Some(port_), mode: flutter_rust_bridge::for_generated::FfiCallMode::Stream }, move || { move |context| async move { + transform_result_dco((move || async move { + Result::<_,()>::Ok(crate::api::pseudo_manual::mirror_twin_rust_async::mirror_option_enum_stream_twin_rust_async(StreamSink::new(context.rust2dart_context().stream_sink::<_,Option>())).await) + })().await) + } }) +} fn wire_mirror_struct_stream_twin_rust_async_impl( port_: flutter_rust_bridge::for_generated::MessagePort, ) { @@ -20650,6 +20716,36 @@ fn wire_is_app_embedded_twin_rust_async_sse_impl( })().await) } }) } +fn wire_mirror_enum_stream_twin_rust_async_sse_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::(flutter_rust_bridge::for_generated::TaskInfo{ debug_name: "mirror_enum_stream_twin_rust_async_sse", port: Some(port_), mode: flutter_rust_bridge::for_generated::FfiCallMode::Stream }, move || { + let message = unsafe { flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire(ptr_, rust_vec_len_, data_len_) }; + let mut deserializer = flutter_rust_bridge::for_generated::SseDeserializer::new(message); + deserializer.end(); move |context| async move { + transform_result_sse((move || async move { + Result::<_,()>::Ok(crate::api::pseudo_manual::mirror_twin_rust_async_sse::mirror_enum_stream_twin_rust_async_sse(StreamSink::new(context.rust2dart_context().stream_sink::<_,mirror_ApplicationMode>())).await) + })().await) + } }) +} +fn wire_mirror_option_enum_stream_twin_rust_async_sse_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::(flutter_rust_bridge::for_generated::TaskInfo{ debug_name: "mirror_option_enum_stream_twin_rust_async_sse", port: Some(port_), mode: flutter_rust_bridge::for_generated::FfiCallMode::Stream }, move || { + let message = unsafe { flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire(ptr_, rust_vec_len_, data_len_) }; + let mut deserializer = flutter_rust_bridge::for_generated::SseDeserializer::new(message); + deserializer.end(); move |context| async move { + transform_result_sse((move || async move { + Result::<_,()>::Ok(crate::api::pseudo_manual::mirror_twin_rust_async_sse::mirror_option_enum_stream_twin_rust_async_sse(StreamSink::new(context.rust2dart_context().stream_sink::<_,Option>())).await) + })().await) + } }) +} fn wire_mirror_struct_stream_twin_rust_async_sse_impl( port_: flutter_rust_bridge::for_generated::MessagePort, ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, @@ -21096,6 +21192,60 @@ fn wire_is_app_embedded_twin_sse_impl( }, ) } +fn wire_mirror_enum_stream_twin_sse_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "mirror_enum_stream_twin_sse", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Stream, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + deserializer.end(); + move |context| { + transform_result_sse((move || { + Result::<_, ()>::Ok( + crate::api::pseudo_manual::mirror_twin_sse::mirror_enum_stream_twin_sse( + StreamSink::new( + context + .rust2dart_context() + .stream_sink::<_, mirror_ApplicationMode>(), + ), + ), + ) + })()) + } + }, + ) +} +fn wire_mirror_option_enum_stream_twin_sse_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::(flutter_rust_bridge::for_generated::TaskInfo{ debug_name: "mirror_option_enum_stream_twin_sse", port: Some(port_), mode: flutter_rust_bridge::for_generated::FfiCallMode::Stream }, move || { + let message = unsafe { flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire(ptr_, rust_vec_len_, data_len_) }; + let mut deserializer = flutter_rust_bridge::for_generated::SseDeserializer::new(message); + deserializer.end(); move |context| { + transform_result_sse((move || { + Result::<_,()>::Ok(crate::api::pseudo_manual::mirror_twin_sse::mirror_option_enum_stream_twin_sse(StreamSink::new(context.rust2dart_context().stream_sink::<_,Option>()))) + })()) + } }) +} fn wire_mirror_struct_stream_twin_sse_impl( port_: flutter_rust_bridge::for_generated::MessagePort, ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, @@ -21484,6 +21634,39 @@ fn wire_is_app_embedded_twin_sync_impl( }, ) } +fn wire_mirror_enum_stream_twin_sync_impl(port_: flutter_rust_bridge::for_generated::MessagePort) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "mirror_enum_stream_twin_sync", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Stream, + }, + move || { + move |context| { + transform_result_dco((move || { + Result::<_, ()>::Ok( + crate::api::pseudo_manual::mirror_twin_sync::mirror_enum_stream_twin_sync( + StreamSink::new( + context + .rust2dart_context() + .stream_sink::<_, mirror_ApplicationMode>(), + ), + ), + ) + })()) + } + }, + ) +} +fn wire_mirror_option_enum_stream_twin_sync_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::(flutter_rust_bridge::for_generated::TaskInfo{ debug_name: "mirror_option_enum_stream_twin_sync", port: Some(port_), mode: flutter_rust_bridge::for_generated::FfiCallMode::Stream }, move || { move |context| { + transform_result_dco((move || { + Result::<_,()>::Ok(crate::api::pseudo_manual::mirror_twin_sync::mirror_option_enum_stream_twin_sync(StreamSink::new(context.rust2dart_context().stream_sink::<_,Option>()))) + })()) + } }) +} fn wire_mirror_struct_stream_twin_sync_impl( port_: flutter_rust_bridge::for_generated::MessagePort, ) { @@ -21841,6 +22024,36 @@ fn wire_is_app_embedded_twin_sync_sse_impl( }, ) } +fn wire_mirror_enum_stream_twin_sync_sse_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::(flutter_rust_bridge::for_generated::TaskInfo{ debug_name: "mirror_enum_stream_twin_sync_sse", port: Some(port_), mode: flutter_rust_bridge::for_generated::FfiCallMode::Stream }, move || { + let message = unsafe { flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire(ptr_, rust_vec_len_, data_len_) }; + let mut deserializer = flutter_rust_bridge::for_generated::SseDeserializer::new(message); + deserializer.end(); move |context| { + transform_result_sse((move || { + Result::<_,()>::Ok(crate::api::pseudo_manual::mirror_twin_sync_sse::mirror_enum_stream_twin_sync_sse(StreamSink::new(context.rust2dart_context().stream_sink::<_,mirror_ApplicationMode>()))) + })()) + } }) +} +fn wire_mirror_option_enum_stream_twin_sync_sse_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::(flutter_rust_bridge::for_generated::TaskInfo{ debug_name: "mirror_option_enum_stream_twin_sync_sse", port: Some(port_), mode: flutter_rust_bridge::for_generated::FfiCallMode::Stream }, move || { + let message = unsafe { flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire(ptr_, rust_vec_len_, data_len_) }; + let mut deserializer = flutter_rust_bridge::for_generated::SseDeserializer::new(message); + deserializer.end(); move |context| { + transform_result_sse((move || { + Result::<_,()>::Ok(crate::api::pseudo_manual::mirror_twin_sync_sse::mirror_option_enum_stream_twin_sync_sse(StreamSink::new(context.rust2dart_context().stream_sink::<_,Option>()))) + })()) + } }) +} fn wire_mirror_struct_stream_twin_sync_sse_impl( port_: flutter_rust_bridge::for_generated::MessagePort, ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, @@ -51459,6 +51672,21 @@ impl SseDecode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + if (::sse_decode(deserializer)) { + return Some( + ::sse_decode( + deserializer, + ), + ); + } else { + return None; + } + } +} + impl SseDecode for Option { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -82179,6 +82407,18 @@ impl SseEncode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.is_some(), serializer); + if let Some(value) = self { + ::sse_encode( + value, serializer, + ); + } + } +} + impl SseEncode for Option { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { diff --git a/frb_example/pure_dart/rust/src/frb_generated.web.rs b/frb_example/pure_dart/rust/src/frb_generated.web.rs index 919082690d2..ecae1eb3f8a 100644 --- a/frb_example/pure_dart/rust/src/frb_generated.web.rs +++ b/frb_example/pure_dart/rust/src/frb_generated.web.rs @@ -12651,6 +12651,18 @@ pub fn wire_is_app_embedded_twin_normal( wire_is_app_embedded_twin_normal_impl(port_, app_settings) } +#[wasm_bindgen] +pub fn wire_mirror_enum_stream_twin_normal(port_: flutter_rust_bridge::for_generated::MessagePort) { + wire_mirror_enum_stream_twin_normal_impl(port_) +} + +#[wasm_bindgen] +pub fn wire_mirror_option_enum_stream_twin_normal( + port_: flutter_rust_bridge::for_generated::MessagePort, +) { + wire_mirror_option_enum_stream_twin_normal_impl(port_) +} + #[wasm_bindgen] pub fn wire_mirror_struct_stream_twin_normal( port_: flutter_rust_bridge::for_generated::MessagePort, @@ -23534,6 +23546,20 @@ pub fn wire_is_app_embedded_twin_rust_async( wire_is_app_embedded_twin_rust_async_impl(port_, app_settings) } +#[wasm_bindgen] +pub fn wire_mirror_enum_stream_twin_rust_async( + port_: flutter_rust_bridge::for_generated::MessagePort, +) { + wire_mirror_enum_stream_twin_rust_async_impl(port_) +} + +#[wasm_bindgen] +pub fn wire_mirror_option_enum_stream_twin_rust_async( + port_: flutter_rust_bridge::for_generated::MessagePort, +) { + wire_mirror_option_enum_stream_twin_rust_async_impl(port_) +} + #[wasm_bindgen] pub fn wire_mirror_struct_stream_twin_rust_async( port_: flutter_rust_bridge::for_generated::MessagePort, @@ -23703,6 +23729,26 @@ pub fn wire_is_app_embedded_twin_rust_async_sse( wire_is_app_embedded_twin_rust_async_sse_impl(port_, ptr_, rust_vec_len_, data_len_) } +#[wasm_bindgen] +pub fn wire_mirror_enum_stream_twin_rust_async_sse( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + wire_mirror_enum_stream_twin_rust_async_sse_impl(port_, ptr_, rust_vec_len_, data_len_) +} + +#[wasm_bindgen] +pub fn wire_mirror_option_enum_stream_twin_rust_async_sse( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + wire_mirror_option_enum_stream_twin_rust_async_sse_impl(port_, ptr_, rust_vec_len_, data_len_) +} + #[wasm_bindgen] pub fn wire_mirror_struct_stream_twin_rust_async_sse( port_: flutter_rust_bridge::for_generated::MessagePort, @@ -23938,6 +23984,26 @@ pub fn wire_is_app_embedded_twin_sse( wire_is_app_embedded_twin_sse_impl(port_, ptr_, rust_vec_len_, data_len_) } +#[wasm_bindgen] +pub fn wire_mirror_enum_stream_twin_sse( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + wire_mirror_enum_stream_twin_sse_impl(port_, ptr_, rust_vec_len_, data_len_) +} + +#[wasm_bindgen] +pub fn wire_mirror_option_enum_stream_twin_sse( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + wire_mirror_option_enum_stream_twin_sse_impl(port_, ptr_, rust_vec_len_, data_len_) +} + #[wasm_bindgen] pub fn wire_mirror_struct_stream_twin_sse( port_: flutter_rust_bridge::for_generated::MessagePort, @@ -24113,6 +24179,18 @@ pub fn wire_is_app_embedded_twin_sync( wire_is_app_embedded_twin_sync_impl(app_settings) } +#[wasm_bindgen] +pub fn wire_mirror_enum_stream_twin_sync(port_: flutter_rust_bridge::for_generated::MessagePort) { + wire_mirror_enum_stream_twin_sync_impl(port_) +} + +#[wasm_bindgen] +pub fn wire_mirror_option_enum_stream_twin_sync( + port_: flutter_rust_bridge::for_generated::MessagePort, +) { + wire_mirror_option_enum_stream_twin_sync_impl(port_) +} + #[wasm_bindgen] pub fn wire_mirror_struct_stream_twin_sync(port_: flutter_rust_bridge::for_generated::MessagePort) { wire_mirror_struct_stream_twin_sync_impl(port_) @@ -24262,6 +24340,26 @@ pub fn wire_is_app_embedded_twin_sync_sse( wire_is_app_embedded_twin_sync_sse_impl(ptr_, rust_vec_len_, data_len_) } +#[wasm_bindgen] +pub fn wire_mirror_enum_stream_twin_sync_sse( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + wire_mirror_enum_stream_twin_sync_sse_impl(port_, ptr_, rust_vec_len_, data_len_) +} + +#[wasm_bindgen] +pub fn wire_mirror_option_enum_stream_twin_sync_sse( + port_: flutter_rust_bridge::for_generated::MessagePort, + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) { + wire_mirror_option_enum_stream_twin_sync_sse_impl(port_, ptr_, rust_vec_len_, data_len_) +} + #[wasm_bindgen] pub fn wire_mirror_struct_stream_twin_sync_sse( port_: flutter_rust_bridge::for_generated::MessagePort, diff --git a/frb_example/pure_dart/test/api/mirror_test.dart b/frb_example/pure_dart/test/api/mirror_test.dart index aa796582e76..e249573d118 100644 --- a/frb_example/pure_dart/test/api/mirror_test.dart +++ b/frb_example/pure_dart/test/api/mirror_test.dart @@ -145,6 +145,21 @@ Future main({bool skipRustLibInit = false}) async { final output = await testHashmapWithMirroredValueTwinNormal(); expect(output.map, {'key': HashMapValue(inner: 'value')}); }); + + test('mirror_enum_stream_twin_normal', () async { + final output = await mirrorEnumStreamTwinNormal().toList(); + expect(output.length, 2); + expect(output[0], ApplicationMode.embedded); + expect(output[1], ApplicationMode.standalone); + }); + + test('mirror_option_enum_stream_twin_normal', () async { + final output = await mirrorOptionEnumStreamTwinNormal().toList(); + expect(output.length, 3); + expect(output[0], ApplicationMode.embedded); + expect(output[1], null); + expect(output[2], ApplicationMode.standalone); + }); } int _createGarbage() { diff --git a/frb_example/pure_dart/test/api/pseudo_manual/mirror_twin_rust_async_sse_test.dart b/frb_example/pure_dart/test/api/pseudo_manual/mirror_twin_rust_async_sse_test.dart index 117995d3b51..cda91680102 100644 --- a/frb_example/pure_dart/test/api/pseudo_manual/mirror_twin_rust_async_sse_test.dart +++ b/frb_example/pure_dart/test/api/pseudo_manual/mirror_twin_rust_async_sse_test.dart @@ -151,6 +151,21 @@ Future main({bool skipRustLibInit = false}) async { final output = await testHashmapWithMirroredValueTwinRustAsyncSse(); expect(output.map, {'key': HashMapValue(inner: 'value')}); }); + + test('mirror_enum_stream_twin_normal', () async { + final output = await mirrorEnumStreamTwinRustAsyncSse().toList(); + expect(output.length, 2); + expect(output[0], ApplicationMode.embedded); + expect(output[1], ApplicationMode.standalone); + }); + + test('mirror_option_enum_stream_twin_normal', () async { + final output = await mirrorOptionEnumStreamTwinRustAsyncSse().toList(); + expect(output.length, 3); + expect(output[0], ApplicationMode.embedded); + expect(output[1], null); + expect(output[2], ApplicationMode.standalone); + }); } int _createGarbage() { diff --git a/frb_example/pure_dart/test/api/pseudo_manual/mirror_twin_rust_async_test.dart b/frb_example/pure_dart/test/api/pseudo_manual/mirror_twin_rust_async_test.dart index 5f655facc98..f3a84bf63b2 100644 --- a/frb_example/pure_dart/test/api/pseudo_manual/mirror_twin_rust_async_test.dart +++ b/frb_example/pure_dart/test/api/pseudo_manual/mirror_twin_rust_async_test.dart @@ -149,6 +149,21 @@ Future main({bool skipRustLibInit = false}) async { final output = await testHashmapWithMirroredValueTwinRustAsync(); expect(output.map, {'key': HashMapValue(inner: 'value')}); }); + + test('mirror_enum_stream_twin_normal', () async { + final output = await mirrorEnumStreamTwinRustAsync().toList(); + expect(output.length, 2); + expect(output[0], ApplicationMode.embedded); + expect(output[1], ApplicationMode.standalone); + }); + + test('mirror_option_enum_stream_twin_normal', () async { + final output = await mirrorOptionEnumStreamTwinRustAsync().toList(); + expect(output.length, 3); + expect(output[0], ApplicationMode.embedded); + expect(output[1], null); + expect(output[2], ApplicationMode.standalone); + }); } int _createGarbage() { diff --git a/frb_example/pure_dart/test/api/pseudo_manual/mirror_twin_sse_test.dart b/frb_example/pure_dart/test/api/pseudo_manual/mirror_twin_sse_test.dart index 89ebadf325b..c9fc3f9de8a 100644 --- a/frb_example/pure_dart/test/api/pseudo_manual/mirror_twin_sse_test.dart +++ b/frb_example/pure_dart/test/api/pseudo_manual/mirror_twin_sse_test.dart @@ -148,6 +148,21 @@ Future main({bool skipRustLibInit = false}) async { final output = await testHashmapWithMirroredValueTwinSse(); expect(output.map, {'key': HashMapValue(inner: 'value')}); }); + + test('mirror_enum_stream_twin_normal', () async { + final output = await mirrorEnumStreamTwinSse().toList(); + expect(output.length, 2); + expect(output[0], ApplicationMode.embedded); + expect(output[1], ApplicationMode.standalone); + }); + + test('mirror_option_enum_stream_twin_normal', () async { + final output = await mirrorOptionEnumStreamTwinSse().toList(); + expect(output.length, 3); + expect(output[0], ApplicationMode.embedded); + expect(output[1], null); + expect(output[2], ApplicationMode.standalone); + }); } int _createGarbage() { diff --git a/frb_example/pure_dart/test/api/pseudo_manual/mirror_twin_sync_sse_test.dart b/frb_example/pure_dart/test/api/pseudo_manual/mirror_twin_sync_sse_test.dart index a93631cf9ce..4cc467fe317 100644 --- a/frb_example/pure_dart/test/api/pseudo_manual/mirror_twin_sync_sse_test.dart +++ b/frb_example/pure_dart/test/api/pseudo_manual/mirror_twin_sync_sse_test.dart @@ -149,6 +149,21 @@ Future main({bool skipRustLibInit = false}) async { final output = await testHashmapWithMirroredValueTwinSyncSse(); expect(output.map, {'key': HashMapValue(inner: 'value')}); }); + + test('mirror_enum_stream_twin_normal', () async { + final output = await mirrorEnumStreamTwinSyncSse().toList(); + expect(output.length, 2); + expect(output[0], ApplicationMode.embedded); + expect(output[1], ApplicationMode.standalone); + }); + + test('mirror_option_enum_stream_twin_normal', () async { + final output = await mirrorOptionEnumStreamTwinSyncSse().toList(); + expect(output.length, 3); + expect(output[0], ApplicationMode.embedded); + expect(output[1], null); + expect(output[2], ApplicationMode.standalone); + }); } int _createGarbage() { diff --git a/frb_example/pure_dart/test/api/pseudo_manual/mirror_twin_sync_test.dart b/frb_example/pure_dart/test/api/pseudo_manual/mirror_twin_sync_test.dart index 50745e80cd0..dd787cc127f 100644 --- a/frb_example/pure_dart/test/api/pseudo_manual/mirror_twin_sync_test.dart +++ b/frb_example/pure_dart/test/api/pseudo_manual/mirror_twin_sync_test.dart @@ -148,6 +148,21 @@ Future main({bool skipRustLibInit = false}) async { final output = await testHashmapWithMirroredValueTwinSync(); expect(output.map, {'key': HashMapValue(inner: 'value')}); }); + + test('mirror_enum_stream_twin_normal', () async { + final output = await mirrorEnumStreamTwinSync().toList(); + expect(output.length, 2); + expect(output[0], ApplicationMode.embedded); + expect(output[1], ApplicationMode.standalone); + }); + + test('mirror_option_enum_stream_twin_normal', () async { + final output = await mirrorOptionEnumStreamTwinSync().toList(); + expect(output.length, 3); + expect(output[0], ApplicationMode.embedded); + expect(output[1], null); + expect(output[2], ApplicationMode.standalone); + }); } int _createGarbage() { diff --git a/frb_example/pure_dart_pde/rust/src/api/mirror.rs b/frb_example/pure_dart_pde/rust/src/api/mirror.rs index 7ac498ae210..274e9259ec0 100644 --- a/frb_example/pure_dart_pde/rust/src/api/mirror.rs +++ b/frb_example/pure_dart_pde/rust/src/api/mirror.rs @@ -262,3 +262,14 @@ pub fn test_hashmap_with_mirrored_value_twin_normal() -> StructWithHashMap { }, } } + +pub fn mirror_enum_stream_twin_normal(sink: StreamSink) { + sink.add(ApplicationMode::Embedded).unwrap(); + sink.add(ApplicationMode::Standalone).unwrap(); +} + +pub fn mirror_option_enum_stream_twin_normal(sink: StreamSink>) { + sink.add(Some(ApplicationMode::Embedded)).unwrap(); + sink.add(None).unwrap(); + sink.add(Some(ApplicationMode::Standalone)).unwrap(); +} diff --git a/frb_example/pure_dart_pde/rust/src/api/pseudo_manual/mirror_twin_rust_async.rs b/frb_example/pure_dart_pde/rust/src/api/pseudo_manual/mirror_twin_rust_async.rs index 4aada17d80a..faa7ac15137 100644 --- a/frb_example/pure_dart_pde/rust/src/api/pseudo_manual/mirror_twin_rust_async.rs +++ b/frb_example/pure_dart_pde/rust/src/api/pseudo_manual/mirror_twin_rust_async.rs @@ -268,3 +268,14 @@ pub async fn test_hashmap_with_mirrored_value_twin_rust_async() -> StructWithHas }, } } + +pub async fn mirror_enum_stream_twin_rust_async(sink: StreamSink) { + sink.add(ApplicationMode::Embedded).unwrap(); + sink.add(ApplicationMode::Standalone).unwrap(); +} + +pub async fn mirror_option_enum_stream_twin_rust_async(sink: StreamSink>) { + sink.add(Some(ApplicationMode::Embedded)).unwrap(); + sink.add(None).unwrap(); + sink.add(Some(ApplicationMode::Standalone)).unwrap(); +} diff --git a/frb_example/pure_dart_pde/rust/src/api/pseudo_manual/mirror_twin_sync.rs b/frb_example/pure_dart_pde/rust/src/api/pseudo_manual/mirror_twin_sync.rs index 459271b20d2..0d48c13853b 100644 --- a/frb_example/pure_dart_pde/rust/src/api/pseudo_manual/mirror_twin_sync.rs +++ b/frb_example/pure_dart_pde/rust/src/api/pseudo_manual/mirror_twin_sync.rs @@ -285,3 +285,16 @@ pub fn test_hashmap_with_mirrored_value_twin_sync() -> StructWithHashMap { }, } } + +#[flutter_rust_bridge::frb(sync)] +pub fn mirror_enum_stream_twin_sync(sink: StreamSink) { + sink.add(ApplicationMode::Embedded).unwrap(); + sink.add(ApplicationMode::Standalone).unwrap(); +} + +#[flutter_rust_bridge::frb(sync)] +pub fn mirror_option_enum_stream_twin_sync(sink: StreamSink>) { + sink.add(Some(ApplicationMode::Embedded)).unwrap(); + sink.add(None).unwrap(); + sink.add(Some(ApplicationMode::Standalone)).unwrap(); +} diff --git a/frb_example/pure_dart_pde/test/api/mirror_test.dart b/frb_example/pure_dart_pde/test/api/mirror_test.dart index e063e118303..0dea99c869d 100644 --- a/frb_example/pure_dart_pde/test/api/mirror_test.dart +++ b/frb_example/pure_dart_pde/test/api/mirror_test.dart @@ -147,6 +147,21 @@ Future main({bool skipRustLibInit = false}) async { final output = await testHashmapWithMirroredValueTwinNormal(); expect(output.map, {'key': HashMapValue(inner: 'value')}); }); + + test('mirror_enum_stream_twin_normal', () async { + final output = await mirrorEnumStreamTwinNormal().toList(); + expect(output.length, 2); + expect(output[0], ApplicationMode.embedded); + expect(output[1], ApplicationMode.standalone); + }); + + test('mirror_option_enum_stream_twin_normal', () async { + final output = await mirrorOptionEnumStreamTwinNormal().toList(); + expect(output.length, 3); + expect(output[0], ApplicationMode.embedded); + expect(output[1], null); + expect(output[2], ApplicationMode.standalone); + }); } int _createGarbage() { diff --git a/frb_example/pure_dart_pde/test/api/pseudo_manual/mirror_twin_rust_async_test.dart b/frb_example/pure_dart_pde/test/api/pseudo_manual/mirror_twin_rust_async_test.dart index 6581a740877..49da56ceb07 100644 --- a/frb_example/pure_dart_pde/test/api/pseudo_manual/mirror_twin_rust_async_test.dart +++ b/frb_example/pure_dart_pde/test/api/pseudo_manual/mirror_twin_rust_async_test.dart @@ -151,6 +151,21 @@ Future main({bool skipRustLibInit = false}) async { final output = await testHashmapWithMirroredValueTwinRustAsync(); expect(output.map, {'key': HashMapValue(inner: 'value')}); }); + + test('mirror_enum_stream_twin_normal', () async { + final output = await mirrorEnumStreamTwinRustAsync().toList(); + expect(output.length, 2); + expect(output[0], ApplicationMode.embedded); + expect(output[1], ApplicationMode.standalone); + }); + + test('mirror_option_enum_stream_twin_normal', () async { + final output = await mirrorOptionEnumStreamTwinRustAsync().toList(); + expect(output.length, 3); + expect(output[0], ApplicationMode.embedded); + expect(output[1], null); + expect(output[2], ApplicationMode.standalone); + }); } int _createGarbage() { diff --git a/frb_example/pure_dart_pde/test/api/pseudo_manual/mirror_twin_sync_test.dart b/frb_example/pure_dart_pde/test/api/pseudo_manual/mirror_twin_sync_test.dart index 55ba15cd43f..e0065c5494c 100644 --- a/frb_example/pure_dart_pde/test/api/pseudo_manual/mirror_twin_sync_test.dart +++ b/frb_example/pure_dart_pde/test/api/pseudo_manual/mirror_twin_sync_test.dart @@ -150,6 +150,21 @@ Future main({bool skipRustLibInit = false}) async { final output = await testHashmapWithMirroredValueTwinSync(); expect(output.map, {'key': HashMapValue(inner: 'value')}); }); + + test('mirror_enum_stream_twin_normal', () async { + final output = await mirrorEnumStreamTwinSync().toList(); + expect(output.length, 2); + expect(output[0], ApplicationMode.embedded); + expect(output[1], ApplicationMode.standalone); + }); + + test('mirror_option_enum_stream_twin_normal', () async { + final output = await mirrorOptionEnumStreamTwinSync().toList(); + expect(output.length, 3); + expect(output[0], ApplicationMode.embedded); + expect(output[1], null); + expect(output[2], ApplicationMode.standalone); + }); } int _createGarbage() { diff --git a/tools/frb_internal/lib/src/frb_example_pure_dart_generator/rust/entrypoint.dart b/tools/frb_internal/lib/src/frb_example_pure_dart_generator/rust/entrypoint.dart index 58c0d674707..dafa1f611f0 100644 --- a/tools/frb_internal/lib/src/frb_example_pure_dart_generator/rust/entrypoint.dart +++ b/tools/frb_internal/lib/src/frb_example_pure_dart_generator/rust/entrypoint.dart @@ -68,9 +68,14 @@ class RustGenerator extends BaseGenerator { RegExp(r'StreamSink>'), (m) => 'StreamSink, flutter_rust_bridge::SseCodec>') + .replaceAllMapped( + RegExp(r'StreamSink>'), + (m) => + 'StreamSink, flutter_rust_bridge::SseCodec>') .replaceAllMapped( RegExp(r'StreamSink<(.*?)>'), - (m) => m.group(1)!.startsWith('Vec') + (m) => m.group(1)!.startsWith('Vec') || + m.group(1)!.startsWith('Option') ? m.group(0)! : 'StreamSink<${m.group(1)}, flutter_rust_bridge::SseCodec>'); }