// This file is automatically generated, so please do not edit it. // Generated by `flutter_rust_bridge`@ 2.0.0-dev.27. // ignore_for_file: unused_import, unused_element, unnecessary_import, duplicate_ignore, invalid_use_of_internal_member, annotate_overrides, non_constant_identifier_names, curly_braces_in_flow_control_structures, prefer_const_literals_to_create_immutables, unused_field import 'api.dart'; import 'dart:async'; import 'dart:convert'; import 'frb_generated.io.dart' if (dart.library.html) 'frb_generated.web.dart'; import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; /// Main entrypoint of the Rust API class RustLib extends BaseEntrypoint { @internal static final instance = RustLib._(); RustLib._(); /// Initialize flutter_rust_bridge static Future init({ RustLibApi? api, BaseHandler? handler, ExternalLibrary? externalLibrary, }) async { await instance.initImpl( api: api, handler: handler, externalLibrary: externalLibrary, ); } /// Dispose flutter_rust_bridge /// /// The call to this function is optional, since flutter_rust_bridge (and everything else) /// is automatically disposed when the app stops. static void dispose() => instance.disposeImpl(); @override ApiImplConstructor get apiImplConstructor => RustLibApiImpl.new; @override WireConstructor get wireConstructor => RustLibWire.fromExternalLibrary; @override Future executeRustInitializers() async {} @override ExternalLibraryLoaderConfig get defaultExternalLibraryLoaderConfig => kDefaultExternalLibraryLoaderConfig; @override String get codegenVersion => '2.0.0-dev.27'; static const kDefaultExternalLibraryLoaderConfig = ExternalLibraryLoaderConfig( stem: 'rust_lib', ioDirectory: 'rust_lib/target/release/', webPrefix: 'pkg/', ); } abstract class RustLibApi extends BaseApi { Stream infoLogger({dynamic hint}); Future panic({dynamic hint}); Future test({required int i, dynamic hint}); } class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { RustLibApiImpl({ required super.handler, required super.wire, required super.generalizedFrbRustBinding, required super.portManager, }); @override Stream infoLogger({dynamic hint}) { return handler.executeStream(StreamTask( callFfi: (port_) { final serializer = SseSerializer(generalizedFrbRustBinding); pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 3, port: port_); }, codec: SseCodec( decodeSuccessData: sse_decode_log_entry, decodeErrorData: null, ), constMeta: kInfoLoggerConstMeta, argValues: [], apiImpl: this, hint: hint, )); } TaskConstMeta get kInfoLoggerConstMeta => const TaskConstMeta( debugName: "info_logger", argNames: [], ); @override Future panic({dynamic hint}) { return handler.executeNormal(NormalTask( callFfi: (port_) { final serializer = SseSerializer(generalizedFrbRustBinding); pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 2, port: port_); }, codec: SseCodec( decodeSuccessData: sse_decode_unit, decodeErrorData: null, ), constMeta: kPanicConstMeta, argValues: [], apiImpl: this, hint: hint, )); } TaskConstMeta get kPanicConstMeta => const TaskConstMeta( debugName: "panic", argNames: [], ); @override Future test({required int i, dynamic hint}) { return handler.executeNormal(NormalTask( callFfi: (port_) { final serializer = SseSerializer(generalizedFrbRustBinding); sse_encode_i_32(i, serializer); pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 1, port: port_); }, codec: SseCodec( decodeSuccessData: sse_decode_unit, decodeErrorData: null, ), constMeta: kTestConstMeta, argValues: [i], apiImpl: this, hint: hint, )); } TaskConstMeta get kTestConstMeta => const TaskConstMeta( debugName: "test", argNames: ["i"], ); @protected String dco_decode_String(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs return raw as String; } @protected int dco_decode_i_32(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs return raw as int; } @protected int dco_decode_i_64(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs return dcoDecodeI64OrU64(raw); } @protected Level dco_decode_level(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs return Level.values[raw as int]; } @protected Uint8List dco_decode_list_prim_u_8_strict(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs return raw as Uint8List; } @protected LogEntry dco_decode_log_entry(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs final arr = raw as List; if (arr.length != 4) throw Exception('unexpected arr length: expect 4 but see ${arr.length}'); return LogEntry( timeMillis: dco_decode_i_64(arr[0]), msg: dco_decode_String(arr[1]), logLevel: dco_decode_level(arr[2]), lbl: dco_decode_String(arr[3]), ); } @protected int dco_decode_u_8(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs return raw as int; } @protected void dco_decode_unit(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs return; } @protected String sse_decode_String(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs var inner = sse_decode_list_prim_u_8_strict(deserializer); return utf8.decoder.convert(inner); } @protected int sse_decode_i_32(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs return deserializer.buffer.getInt32(); } @protected int sse_decode_i_64(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs return deserializer.buffer.getInt64(); } @protected Level sse_decode_level(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs var inner = sse_decode_i_32(deserializer); return Level.values[inner]; } @protected Uint8List sse_decode_list_prim_u_8_strict(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs var len_ = sse_decode_i_32(deserializer); return deserializer.buffer.getUint8List(len_); } @protected LogEntry sse_decode_log_entry(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs var var_timeMillis = sse_decode_i_64(deserializer); var var_msg = sse_decode_String(deserializer); var var_logLevel = sse_decode_level(deserializer); var var_lbl = sse_decode_String(deserializer); return LogEntry( timeMillis: var_timeMillis, msg: var_msg, logLevel: var_logLevel, lbl: var_lbl); } @protected int sse_decode_u_8(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs return deserializer.buffer.getUint8(); } @protected void sse_decode_unit(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs } @protected bool sse_decode_bool(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs return deserializer.buffer.getUint8() != 0; } @protected void sse_encode_String(String self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs sse_encode_list_prim_u_8_strict(utf8.encoder.convert(self), serializer); } @protected void sse_encode_i_32(int self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs serializer.buffer.putInt32(self); } @protected void sse_encode_i_64(int self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs serializer.buffer.putInt64(self); } @protected void sse_encode_level(Level self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs sse_encode_i_32(self.index, serializer); } @protected void sse_encode_list_prim_u_8_strict( Uint8List self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs sse_encode_i_32(self.length, serializer); serializer.buffer.putUint8List(self); } @protected void sse_encode_log_entry(LogEntry self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs sse_encode_i_64(self.timeMillis, serializer); sse_encode_String(self.msg, serializer); sse_encode_level(self.logLevel, serializer); sse_encode_String(self.lbl, serializer); } @protected void sse_encode_u_8(int self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs serializer.buffer.putUint8(self); } @protected void sse_encode_unit(void self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs } @protected void sse_encode_bool(bool self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs serializer.buffer.putUint8(self ? 1 : 0); } }