cuttle/mobile/lib/bridge_generated.dart

418 lines
13 KiB
Dart
Raw Normal View History

2023-08-17 23:14:32 +00:00
// AUTO GENERATED FILE, DO NOT EDIT.
// Generated by `flutter_rust_bridge`@ 1.81.0.
// ignore_for_file: non_constant_identifier_names, unused_element, duplicate_ignore, directives_ordering, curly_braces_in_flow_control_structures, unnecessary_lambdas, slash_for_doc_comments, prefer_const_literals_to_create_immutables, implicit_dynamic_list_literal, duplicate_import, unused_import, unnecessary_import, prefer_single_quotes, prefer_const_constructors, use_super_parameters, always_use_package_imports, annotate_overrides, invalid_use_of_protected_member, constant_identifier_names, invalid_use_of_internal_member, prefer_is_empty, unnecessary_const
import "bridge_definitions.dart";
import 'dart:convert';
import 'dart:async';
import 'package:meta/meta.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge.dart';
import 'package:uuid/uuid.dart';
import 'dart:convert';
import 'dart:async';
import 'package:meta/meta.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge.dart';
import 'package:uuid/uuid.dart';
import 'dart:ffi' as ffi;
class NativeImpl implements Native {
final NativePlatform _platform;
factory NativeImpl(ExternalLibrary dylib) => NativeImpl.raw(NativePlatform(dylib));
/// Only valid on web/WASM platforms.
factory NativeImpl.wasm(FutureOr<WasmModule> module) => NativeImpl(module as ExternalLibrary);
NativeImpl.raw(this._platform);
Future<TxConfig?> getTxConfig({required Uint8List bytes, dynamic hint}) {
var arg0 = _platform.api2wire_uint_8_list(bytes);
2023-08-17 23:14:32 +00:00
return _platform.executeNormal(FlutterRustBridgeTask(
callFfi: (port_) => _platform.inner.wire_get_tx_config(port_, arg0),
parseSuccessData: _wire2api_opt_box_autoadd_tx_config,
constMeta: kGetTxConfigConstMeta,
argValues: [bytes],
2023-08-17 23:14:32 +00:00
hint: hint,
));
}
FlutterRustBridgeTaskConstMeta get kGetTxConfigConstMeta => const FlutterRustBridgeTaskConstMeta(
debugName: "get_tx_config",
argNames: ["bytes"],
2023-08-17 23:14:32 +00:00
);
2023-08-25 23:35:27 +00:00
Future<void> dropTxConfig({required TxConfig txc, dynamic hint}) {
var arg0 = _platform.api2wire_box_autoadd_tx_config(txc);
return _platform.executeNormal(FlutterRustBridgeTask(
callFfi: (port_) => _platform.inner.wire_drop_tx_config(port_, arg0),
parseSuccessData: _wire2api_unit,
constMeta: kDropTxConfigConstMeta,
argValues: [txc],
hint: hint,
));
}
FlutterRustBridgeTaskConstMeta get kDropTxConfigConstMeta => const FlutterRustBridgeTaskConstMeta(
debugName: "drop_tx_config",
argNames: ["txc"],
);
Future<Uint8List?> decodePackets({required List<RaptorPacket> packets, required TxConfig txconf, dynamic hint}) {
var arg0 = _platform.api2wire_list_raptor_packet(packets);
2023-08-19 16:23:12 +00:00
var arg1 = _platform.api2wire_box_autoadd_tx_config(txconf);
return _platform.executeNormal(FlutterRustBridgeTask(
callFfi: (port_) => _platform.inner.wire_decode_packets(port_, arg0, arg1),
parseSuccessData: _wire2api_opt_uint_8_list,
constMeta: kDecodePacketsConstMeta,
argValues: [packets, txconf],
2023-08-19 16:23:12 +00:00
hint: hint,
));
}
FlutterRustBridgeTaskConstMeta get kDecodePacketsConstMeta => const FlutterRustBridgeTaskConstMeta(
debugName: "decode_packets",
argNames: ["packets", "txconf"],
2023-08-19 16:23:12 +00:00
);
2023-08-17 23:14:32 +00:00
void dispose() {
_platform.dispose();
}
// Section: wire2api
String _wire2api_String(dynamic raw) {
return raw as String;
}
TxConfig _wire2api_box_autoadd_tx_config(dynamic raw) {
return _wire2api_tx_config(raw);
}
String? _wire2api_opt_String(dynamic raw) {
return raw == null ? null : _wire2api_String(raw);
}
TxConfig? _wire2api_opt_box_autoadd_tx_config(dynamic raw) {
return raw == null ? null : _wire2api_box_autoadd_tx_config(raw);
}
Uint8List? _wire2api_opt_uint_8_list(dynamic raw) {
return raw == null ? null : _wire2api_uint_8_list(raw);
}
TxConfig _wire2api_tx_config(dynamic raw) {
final arr = raw as List<dynamic>;
if (arr.length != 4) throw Exception('unexpected arr length: expect 4 but see ${arr.length}');
return TxConfig(
len: _wire2api_u64(arr[0]),
mtu: _wire2api_u16(arr[1]),
description: _wire2api_String(arr[2]),
filename: _wire2api_opt_String(arr[3]),
);
2023-08-17 23:14:32 +00:00
}
int _wire2api_u16(dynamic raw) {
2023-08-17 23:14:32 +00:00
return raw as int;
}
int _wire2api_u64(dynamic raw) {
return castInt(raw);
}
int _wire2api_u8(dynamic raw) {
return raw as int;
}
Uint8List _wire2api_uint_8_list(dynamic raw) {
return raw as Uint8List;
2023-08-17 23:14:32 +00:00
}
2023-08-25 23:35:27 +00:00
void _wire2api_unit(dynamic raw) {
return;
}
2023-08-17 23:14:32 +00:00
}
// Section: api2wire
2023-08-19 16:23:12 +00:00
@protected
int api2wire_u16(int raw) {
return raw;
}
@protected
int api2wire_u8(int raw) {
return raw;
}
2023-08-17 23:14:32 +00:00
// Section: finalizer
class NativePlatform extends FlutterRustBridgeBase<NativeWire> {
NativePlatform(ffi.DynamicLibrary dylib) : super(NativeWire(dylib));
// Section: api2wire
2023-08-19 16:23:12 +00:00
@protected
ffi.Pointer<wire_uint_8_list> api2wire_String(String raw) {
return api2wire_uint_8_list(utf8.encoder.convert(raw));
}
@protected
ffi.Pointer<wire_TxConfig> api2wire_box_autoadd_tx_config(TxConfig raw) {
final ptr = inner.new_box_autoadd_tx_config_0();
_api_fill_to_wire_tx_config(raw, ptr.ref);
return ptr;
}
@protected
ffi.Pointer<wire_list_raptor_packet> api2wire_list_raptor_packet(List<RaptorPacket> raw) {
final ans = inner.new_list_raptor_packet_0(raw.length);
for (var i = 0; i < raw.length; ++i) {
_api_fill_to_wire_raptor_packet(raw[i], ans.ref.ptr[i]);
}
return ans;
}
@protected
ffi.Pointer<wire_uint_8_list> api2wire_opt_String(String? raw) {
return raw == null ? ffi.nullptr : api2wire_String(raw);
}
2023-08-19 16:23:12 +00:00
@protected
int api2wire_u64(int raw) {
return raw;
}
@protected
ffi.Pointer<wire_uint_8_list> api2wire_uint_8_list(Uint8List raw) {
final ans = inner.new_uint_8_list_0(raw.length);
ans.ref.ptr.asTypedList(raw.length).setAll(0, raw);
return ans;
}
2023-08-17 23:14:32 +00:00
// Section: finalizer
// Section: api_fill_to_wire
2023-08-19 16:23:12 +00:00
void _api_fill_to_wire_box_autoadd_tx_config(TxConfig apiObj, ffi.Pointer<wire_TxConfig> wireObj) {
_api_fill_to_wire_tx_config(apiObj, wireObj.ref);
}
void _api_fill_to_wire_raptor_packet(RaptorPacket apiObj, wire_RaptorPacket wireObj) {
wireObj.field0 = api2wire_uint_8_list(apiObj.field0);
}
2023-08-19 16:23:12 +00:00
void _api_fill_to_wire_tx_config(TxConfig apiObj, wire_TxConfig wireObj) {
wireObj.len = api2wire_u64(apiObj.len);
wireObj.mtu = api2wire_u16(apiObj.mtu);
wireObj.description = api2wire_String(apiObj.description);
wireObj.filename = api2wire_opt_String(apiObj.filename);
2023-08-19 16:23:12 +00:00
}
2023-08-17 23:14:32 +00:00
}
// ignore_for_file: camel_case_types, non_constant_identifier_names, avoid_positional_boolean_parameters, annotate_overrides, constant_identifier_names
// AUTO GENERATED FILE, DO NOT EDIT.
//
// Generated by `package:ffigen`.
// ignore_for_file: type=lint
/// generated by flutter_rust_bridge
class NativeWire implements FlutterRustBridgeWireBase {
@internal
late final dartApi = DartApiDl(init_frb_dart_api_dl);
/// Holds the symbol lookup function.
final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName) _lookup;
/// The symbols are looked up in [dynamicLibrary].
NativeWire(ffi.DynamicLibrary dynamicLibrary) : _lookup = dynamicLibrary.lookup;
/// The symbols are looked up with [lookup].
NativeWire.fromLookup(ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName) lookup) : _lookup = lookup;
void store_dart_post_cobject(
DartPostCObjectFnType ptr,
) {
return _store_dart_post_cobject(
ptr,
);
}
late final _store_dart_post_cobjectPtr =
_lookup<ffi.NativeFunction<ffi.Void Function(DartPostCObjectFnType)>>('store_dart_post_cobject');
late final _store_dart_post_cobject = _store_dart_post_cobjectPtr.asFunction<void Function(DartPostCObjectFnType)>();
Object get_dart_object(
int ptr,
) {
return _get_dart_object(
ptr,
);
}
late final _get_dart_objectPtr = _lookup<ffi.NativeFunction<ffi.Handle Function(ffi.UintPtr)>>('get_dart_object');
late final _get_dart_object = _get_dart_objectPtr.asFunction<Object Function(int)>();
void drop_dart_object(
int ptr,
) {
return _drop_dart_object(
ptr,
);
}
late final _drop_dart_objectPtr = _lookup<ffi.NativeFunction<ffi.Void Function(ffi.UintPtr)>>('drop_dart_object');
late final _drop_dart_object = _drop_dart_objectPtr.asFunction<void Function(int)>();
int new_dart_opaque(
Object handle,
) {
return _new_dart_opaque(
handle,
);
}
late final _new_dart_opaquePtr = _lookup<ffi.NativeFunction<ffi.UintPtr Function(ffi.Handle)>>('new_dart_opaque');
late final _new_dart_opaque = _new_dart_opaquePtr.asFunction<int Function(Object)>();
int init_frb_dart_api_dl(
ffi.Pointer<ffi.Void> obj,
) {
return _init_frb_dart_api_dl(
obj,
);
}
late final _init_frb_dart_api_dlPtr =
_lookup<ffi.NativeFunction<ffi.IntPtr Function(ffi.Pointer<ffi.Void>)>>('init_frb_dart_api_dl');
late final _init_frb_dart_api_dl = _init_frb_dart_api_dlPtr.asFunction<int Function(ffi.Pointer<ffi.Void>)>();
void wire_get_tx_config(
2023-08-17 23:14:32 +00:00
int port_,
ffi.Pointer<wire_uint_8_list> bytes,
2023-08-17 23:14:32 +00:00
) {
return _wire_get_tx_config(
2023-08-17 23:14:32 +00:00
port_,
bytes,
2023-08-17 23:14:32 +00:00
);
}
late final _wire_get_tx_configPtr =
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64, ffi.Pointer<wire_uint_8_list>)>>('wire_get_tx_config');
late final _wire_get_tx_config =
_wire_get_tx_configPtr.asFunction<void Function(int, ffi.Pointer<wire_uint_8_list>)>();
2023-08-17 23:14:32 +00:00
2023-08-25 23:35:27 +00:00
void wire_drop_tx_config(
int port_,
ffi.Pointer<wire_TxConfig> _txc,
) {
return _wire_drop_tx_config(
port_,
_txc,
);
}
late final _wire_drop_tx_configPtr =
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64, ffi.Pointer<wire_TxConfig>)>>('wire_drop_tx_config');
late final _wire_drop_tx_config =
_wire_drop_tx_configPtr.asFunction<void Function(int, ffi.Pointer<wire_TxConfig>)>();
void wire_decode_packets(
2023-08-19 16:23:12 +00:00
int port_,
ffi.Pointer<wire_list_raptor_packet> packets,
2023-08-19 16:23:12 +00:00
ffi.Pointer<wire_TxConfig> txconf,
) {
return _wire_decode_packets(
2023-08-19 16:23:12 +00:00
port_,
packets,
2023-08-19 16:23:12 +00:00
txconf,
);
}
late final _wire_decode_packetsPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(
ffi.Int64, ffi.Pointer<wire_list_raptor_packet>, ffi.Pointer<wire_TxConfig>)>>('wire_decode_packets');
late final _wire_decode_packets = _wire_decode_packetsPtr
.asFunction<void Function(int, ffi.Pointer<wire_list_raptor_packet>, ffi.Pointer<wire_TxConfig>)>();
2023-08-19 16:23:12 +00:00
ffi.Pointer<wire_TxConfig> new_box_autoadd_tx_config_0() {
return _new_box_autoadd_tx_config_0();
}
late final _new_box_autoadd_tx_config_0Ptr =
_lookup<ffi.NativeFunction<ffi.Pointer<wire_TxConfig> Function()>>('new_box_autoadd_tx_config_0');
late final _new_box_autoadd_tx_config_0 =
_new_box_autoadd_tx_config_0Ptr.asFunction<ffi.Pointer<wire_TxConfig> Function()>();
ffi.Pointer<wire_list_raptor_packet> new_list_raptor_packet_0(
int len,
) {
return _new_list_raptor_packet_0(
len,
);
}
late final _new_list_raptor_packet_0Ptr =
_lookup<ffi.NativeFunction<ffi.Pointer<wire_list_raptor_packet> Function(ffi.Int32)>>('new_list_raptor_packet_0');
late final _new_list_raptor_packet_0 =
_new_list_raptor_packet_0Ptr.asFunction<ffi.Pointer<wire_list_raptor_packet> Function(int)>();
ffi.Pointer<wire_uint_8_list> new_uint_8_list_0(
int len,
2023-08-17 23:14:32 +00:00
) {
return _new_uint_8_list_0(
len,
2023-08-17 23:14:32 +00:00
);
}
late final _new_uint_8_list_0Ptr =
_lookup<ffi.NativeFunction<ffi.Pointer<wire_uint_8_list> Function(ffi.Int32)>>('new_uint_8_list_0');
late final _new_uint_8_list_0 = _new_uint_8_list_0Ptr.asFunction<ffi.Pointer<wire_uint_8_list> Function(int)>();
2023-08-17 23:14:32 +00:00
void free_WireSyncReturn(
WireSyncReturn ptr,
) {
return _free_WireSyncReturn(
ptr,
);
}
late final _free_WireSyncReturnPtr =
_lookup<ffi.NativeFunction<ffi.Void Function(WireSyncReturn)>>('free_WireSyncReturn');
late final _free_WireSyncReturn = _free_WireSyncReturnPtr.asFunction<void Function(WireSyncReturn)>();
}
final class _Dart_Handle extends ffi.Opaque {}
final class wire_uint_8_list extends ffi.Struct {
external ffi.Pointer<ffi.Uint8> ptr;
@ffi.Int32()
external int len;
}
2023-08-19 16:23:12 +00:00
final class wire_TxConfig extends ffi.Struct {
@ffi.Uint64()
external int len;
@ffi.Uint16()
external int mtu;
external ffi.Pointer<wire_uint_8_list> description;
external ffi.Pointer<wire_uint_8_list> filename;
2023-08-19 16:23:12 +00:00
}
2023-08-25 23:35:27 +00:00
final class wire_RaptorPacket extends ffi.Struct {
external ffi.Pointer<wire_uint_8_list> field0;
}
final class wire_list_raptor_packet extends ffi.Struct {
external ffi.Pointer<wire_RaptorPacket> ptr;
@ffi.Int32()
external int len;
}
2023-08-17 23:14:32 +00:00
typedef DartPostCObjectFnType
= ffi.Pointer<ffi.NativeFunction<ffi.Bool Function(DartPort port_id, ffi.Pointer<ffi.Void> message)>>;
typedef DartPort = ffi.Int64;