mirror of
https://ghfast.top/https://github.com/StarCitizenToolBox/app.git
synced 2025-06-28 09:04:45 +08:00
Upgrade to flutter_rust_bridge V2
This commit is contained in:
24
lib/common/rust/api/downloader_api.dart
Normal file
24
lib/common/rust/api/downloader_api.dart
Normal file
@ -0,0 +1,24 @@
|
||||
// This file is automatically generated, so please do not edit it.
|
||||
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.23.
|
||||
|
||||
// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import
|
||||
|
||||
import '../downloader.dart';
|
||||
import '../frb_generated.dart';
|
||||
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
|
||||
|
||||
Stream<DownloadCallbackData> startDownload(
|
||||
{required String url,
|
||||
required String savePath,
|
||||
required String fileName,
|
||||
required int connectionCount,
|
||||
dynamic hint}) =>
|
||||
RustLib.instance.api.startDownload(
|
||||
url: url,
|
||||
savePath: savePath,
|
||||
fileName: fileName,
|
||||
connectionCount: connectionCount,
|
||||
hint: hint);
|
||||
|
||||
Future<void> cancelDownload({required String id, dynamic hint}) =>
|
||||
RustLib.instance.api.cancelDownload(id: id, hint: hint);
|
@ -1,67 +0,0 @@
|
||||
// AUTO GENERATED FILE, DO NOT EDIT.
|
||||
// Generated by `flutter_rust_bridge`@ 1.82.3.
|
||||
// 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 '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 'package:freezed_annotation/freezed_annotation.dart' hide protected;
|
||||
|
||||
part 'bridge_definitions.freezed.dart';
|
||||
|
||||
abstract class Rust {
|
||||
Future<String> ping({dynamic hint});
|
||||
|
||||
FlutterRustBridgeTaskConstMeta get kPingConstMeta;
|
||||
|
||||
Stream<DownloadCallbackData> startDownload(
|
||||
{required String url,
|
||||
required String savePath,
|
||||
required String fileName,
|
||||
required int connectionCount,
|
||||
dynamic hint});
|
||||
|
||||
FlutterRustBridgeTaskConstMeta get kStartDownloadConstMeta;
|
||||
|
||||
Future<void> cancelDownload({required String id, dynamic hint});
|
||||
|
||||
FlutterRustBridgeTaskConstMeta get kCancelDownloadConstMeta;
|
||||
}
|
||||
|
||||
class DownloadCallbackData {
|
||||
final String id;
|
||||
final int total;
|
||||
final int progress;
|
||||
final int speed;
|
||||
final MyDownloaderStatus status;
|
||||
|
||||
const DownloadCallbackData({
|
||||
required this.id,
|
||||
required this.total,
|
||||
required this.progress,
|
||||
required this.speed,
|
||||
required this.status,
|
||||
});
|
||||
}
|
||||
|
||||
@freezed
|
||||
sealed class MyDownloaderStatus with _$MyDownloaderStatus {
|
||||
const factory MyDownloaderStatus.noStart() = MyDownloaderStatus_NoStart;
|
||||
const factory MyDownloaderStatus.running() = MyDownloaderStatus_Running;
|
||||
const factory MyDownloaderStatus.pending(
|
||||
MyNetworkItemPendingType field0,
|
||||
) = MyDownloaderStatus_Pending;
|
||||
const factory MyDownloaderStatus.error(
|
||||
String field0,
|
||||
) = MyDownloaderStatus_Error;
|
||||
const factory MyDownloaderStatus.finished() = MyDownloaderStatus_Finished;
|
||||
}
|
||||
|
||||
enum MyNetworkItemPendingType {
|
||||
QueueUp,
|
||||
Starting,
|
||||
Stopping,
|
||||
Initializing,
|
||||
}
|
@ -1,382 +0,0 @@
|
||||
// AUTO GENERATED FILE, DO NOT EDIT.
|
||||
// Generated by `flutter_rust_bridge`@ 1.82.3.
|
||||
// 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 RustImpl implements Rust {
|
||||
final RustPlatform _platform;
|
||||
factory RustImpl(ExternalLibrary dylib) => RustImpl.raw(RustPlatform(dylib));
|
||||
|
||||
/// Only valid on web/WASM platforms.
|
||||
factory RustImpl.wasm(FutureOr<WasmModule> module) =>
|
||||
RustImpl(module as ExternalLibrary);
|
||||
RustImpl.raw(this._platform);
|
||||
Future<String> ping({dynamic hint}) {
|
||||
return _platform.executeNormal(FlutterRustBridgeTask(
|
||||
callFfi: (port_) => _platform.inner.wire_ping(port_),
|
||||
parseSuccessData: _wire2api_String,
|
||||
parseErrorData: null,
|
||||
constMeta: kPingConstMeta,
|
||||
argValues: [],
|
||||
hint: hint,
|
||||
));
|
||||
}
|
||||
|
||||
FlutterRustBridgeTaskConstMeta get kPingConstMeta =>
|
||||
const FlutterRustBridgeTaskConstMeta(
|
||||
debugName: "ping",
|
||||
argNames: [],
|
||||
);
|
||||
|
||||
Stream<DownloadCallbackData> startDownload(
|
||||
{required String url,
|
||||
required String savePath,
|
||||
required String fileName,
|
||||
required int connectionCount,
|
||||
dynamic hint}) {
|
||||
var arg0 = _platform.api2wire_String(url);
|
||||
var arg1 = _platform.api2wire_String(savePath);
|
||||
var arg2 = _platform.api2wire_String(fileName);
|
||||
var arg3 = api2wire_u8(connectionCount);
|
||||
return _platform.executeStream(FlutterRustBridgeTask(
|
||||
callFfi: (port_) =>
|
||||
_platform.inner.wire_start_download(port_, arg0, arg1, arg2, arg3),
|
||||
parseSuccessData: _wire2api_download_callback_data,
|
||||
parseErrorData: null,
|
||||
constMeta: kStartDownloadConstMeta,
|
||||
argValues: [url, savePath, fileName, connectionCount],
|
||||
hint: hint,
|
||||
));
|
||||
}
|
||||
|
||||
FlutterRustBridgeTaskConstMeta get kStartDownloadConstMeta =>
|
||||
const FlutterRustBridgeTaskConstMeta(
|
||||
debugName: "start_download",
|
||||
argNames: ["url", "savePath", "fileName", "connectionCount"],
|
||||
);
|
||||
|
||||
Future<void> cancelDownload({required String id, dynamic hint}) {
|
||||
var arg0 = _platform.api2wire_String(id);
|
||||
return _platform.executeNormal(FlutterRustBridgeTask(
|
||||
callFfi: (port_) => _platform.inner.wire_cancel_download(port_, arg0),
|
||||
parseSuccessData: _wire2api_unit,
|
||||
parseErrorData: null,
|
||||
constMeta: kCancelDownloadConstMeta,
|
||||
argValues: [id],
|
||||
hint: hint,
|
||||
));
|
||||
}
|
||||
|
||||
FlutterRustBridgeTaskConstMeta get kCancelDownloadConstMeta =>
|
||||
const FlutterRustBridgeTaskConstMeta(
|
||||
debugName: "cancel_download",
|
||||
argNames: ["id"],
|
||||
);
|
||||
|
||||
void dispose() {
|
||||
_platform.dispose();
|
||||
}
|
||||
// Section: wire2api
|
||||
|
||||
String _wire2api_String(dynamic raw) {
|
||||
return raw as String;
|
||||
}
|
||||
|
||||
DownloadCallbackData _wire2api_download_callback_data(dynamic raw) {
|
||||
final arr = raw as List<dynamic>;
|
||||
if (arr.length != 5)
|
||||
throw Exception('unexpected arr length: expect 5 but see ${arr.length}');
|
||||
return DownloadCallbackData(
|
||||
id: _wire2api_String(arr[0]),
|
||||
total: _wire2api_u64(arr[1]),
|
||||
progress: _wire2api_u64(arr[2]),
|
||||
speed: _wire2api_u64(arr[3]),
|
||||
status: _wire2api_my_downloader_status(arr[4]),
|
||||
);
|
||||
}
|
||||
|
||||
int _wire2api_i32(dynamic raw) {
|
||||
return raw as int;
|
||||
}
|
||||
|
||||
MyDownloaderStatus _wire2api_my_downloader_status(dynamic raw) {
|
||||
switch (raw[0]) {
|
||||
case 0:
|
||||
return MyDownloaderStatus_NoStart();
|
||||
case 1:
|
||||
return MyDownloaderStatus_Running();
|
||||
case 2:
|
||||
return MyDownloaderStatus_Pending(
|
||||
_wire2api_my_network_item_pending_type(raw[1]),
|
||||
);
|
||||
case 3:
|
||||
return MyDownloaderStatus_Error(
|
||||
_wire2api_String(raw[1]),
|
||||
);
|
||||
case 4:
|
||||
return MyDownloaderStatus_Finished();
|
||||
default:
|
||||
throw Exception("unreachable");
|
||||
}
|
||||
}
|
||||
|
||||
MyNetworkItemPendingType _wire2api_my_network_item_pending_type(dynamic raw) {
|
||||
return MyNetworkItemPendingType.values[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;
|
||||
}
|
||||
|
||||
void _wire2api_unit(dynamic raw) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Section: api2wire
|
||||
|
||||
@protected
|
||||
int api2wire_u8(int raw) {
|
||||
return raw;
|
||||
}
|
||||
|
||||
// Section: finalizer
|
||||
|
||||
class RustPlatform extends FlutterRustBridgeBase<RustWire> {
|
||||
RustPlatform(ffi.DynamicLibrary dylib) : super(RustWire(dylib));
|
||||
|
||||
// Section: api2wire
|
||||
|
||||
@protected
|
||||
ffi.Pointer<wire_uint_8_list> api2wire_String(String raw) {
|
||||
return api2wire_uint_8_list(utf8.encoder.convert(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;
|
||||
}
|
||||
// Section: finalizer
|
||||
|
||||
// Section: api_fill_to_wire
|
||||
}
|
||||
|
||||
// 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 RustWire 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].
|
||||
RustWire(ffi.DynamicLibrary dynamicLibrary) : _lookup = dynamicLibrary.lookup;
|
||||
|
||||
/// The symbols are looked up with [lookup].
|
||||
RustWire.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_ping(
|
||||
int port_,
|
||||
) {
|
||||
return _wire_ping(
|
||||
port_,
|
||||
);
|
||||
}
|
||||
|
||||
late final _wire_pingPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64)>>('wire_ping');
|
||||
late final _wire_ping = _wire_pingPtr.asFunction<void Function(int)>();
|
||||
|
||||
void wire_start_download(
|
||||
int port_,
|
||||
ffi.Pointer<wire_uint_8_list> url,
|
||||
ffi.Pointer<wire_uint_8_list> save_path,
|
||||
ffi.Pointer<wire_uint_8_list> file_name,
|
||||
int connection_count,
|
||||
) {
|
||||
return _wire_start_download(
|
||||
port_,
|
||||
url,
|
||||
save_path,
|
||||
file_name,
|
||||
connection_count,
|
||||
);
|
||||
}
|
||||
|
||||
late final _wire_start_downloadPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Void Function(
|
||||
ffi.Int64,
|
||||
ffi.Pointer<wire_uint_8_list>,
|
||||
ffi.Pointer<wire_uint_8_list>,
|
||||
ffi.Pointer<wire_uint_8_list>,
|
||||
ffi.Uint8)>>('wire_start_download');
|
||||
late final _wire_start_download = _wire_start_downloadPtr.asFunction<
|
||||
void Function(int, ffi.Pointer<wire_uint_8_list>,
|
||||
ffi.Pointer<wire_uint_8_list>, ffi.Pointer<wire_uint_8_list>, int)>();
|
||||
|
||||
void wire_cancel_download(
|
||||
int port_,
|
||||
ffi.Pointer<wire_uint_8_list> id,
|
||||
) {
|
||||
return _wire_cancel_download(
|
||||
port_,
|
||||
id,
|
||||
);
|
||||
}
|
||||
|
||||
late final _wire_cancel_downloadPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Void Function(ffi.Int64,
|
||||
ffi.Pointer<wire_uint_8_list>)>>('wire_cancel_download');
|
||||
late final _wire_cancel_download = _wire_cancel_downloadPtr
|
||||
.asFunction<void Function(int, ffi.Pointer<wire_uint_8_list>)>();
|
||||
|
||||
ffi.Pointer<wire_uint_8_list> new_uint_8_list_0(
|
||||
int len,
|
||||
) {
|
||||
return _new_uint_8_list_0(
|
||||
len,
|
||||
);
|
||||
}
|
||||
|
||||
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)>();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
typedef DartPostCObjectFnType = ffi.Pointer<
|
||||
ffi.NativeFunction<
|
||||
ffi.Bool Function(DartPort port_id, ffi.Pointer<ffi.Void> message)>>;
|
||||
typedef DartPort = ffi.Int64;
|
64
lib/common/rust/downloader.dart
Normal file
64
lib/common/rust/downloader.dart
Normal file
@ -0,0 +1,64 @@
|
||||
// This file is automatically generated, so please do not edit it.
|
||||
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.23.
|
||||
|
||||
// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import
|
||||
|
||||
import 'frb_generated.dart';
|
||||
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart' hide protected;
|
||||
part 'downloader.freezed.dart';
|
||||
|
||||
class DownloadCallbackData {
|
||||
final String id;
|
||||
final int total;
|
||||
final int progress;
|
||||
final int speed;
|
||||
final MyDownloaderStatus status;
|
||||
|
||||
const DownloadCallbackData({
|
||||
required this.id,
|
||||
required this.total,
|
||||
required this.progress,
|
||||
required this.speed,
|
||||
required this.status,
|
||||
});
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
id.hashCode ^
|
||||
total.hashCode ^
|
||||
progress.hashCode ^
|
||||
speed.hashCode ^
|
||||
status.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is DownloadCallbackData &&
|
||||
runtimeType == other.runtimeType &&
|
||||
id == other.id &&
|
||||
total == other.total &&
|
||||
progress == other.progress &&
|
||||
speed == other.speed &&
|
||||
status == other.status;
|
||||
}
|
||||
|
||||
@freezed
|
||||
sealed class MyDownloaderStatus with _$MyDownloaderStatus {
|
||||
const factory MyDownloaderStatus.noStart() = MyDownloaderStatus_NoStart;
|
||||
const factory MyDownloaderStatus.running() = MyDownloaderStatus_Running;
|
||||
const factory MyDownloaderStatus.pending(
|
||||
MyNetworkItemPendingType field0,
|
||||
) = MyDownloaderStatus_Pending;
|
||||
const factory MyDownloaderStatus.error(
|
||||
String field0,
|
||||
) = MyDownloaderStatus_Error;
|
||||
const factory MyDownloaderStatus.finished() = MyDownloaderStatus_Finished;
|
||||
}
|
||||
|
||||
enum MyNetworkItemPendingType {
|
||||
queueUp,
|
||||
starting,
|
||||
stopping,
|
||||
initializing,
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'bridge_definitions.dart';
|
||||
part of 'downloader.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
@ -122,7 +122,7 @@ class _$MyDownloaderStatus_NoStartImpl implements MyDownloaderStatus_NoStart {
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(dynamic other) {
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$MyDownloaderStatus_NoStartImpl);
|
||||
@ -246,7 +246,7 @@ class _$MyDownloaderStatus_RunningImpl implements MyDownloaderStatus_Running {
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(dynamic other) {
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$MyDownloaderStatus_RunningImpl);
|
||||
@ -388,7 +388,7 @@ class _$MyDownloaderStatus_PendingImpl implements MyDownloaderStatus_Pending {
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(dynamic other) {
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$MyDownloaderStatus_PendingImpl &&
|
||||
@ -544,7 +544,7 @@ class _$MyDownloaderStatus_ErrorImpl implements MyDownloaderStatus_Error {
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(dynamic other) {
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$MyDownloaderStatus_ErrorImpl &&
|
||||
@ -682,7 +682,7 @@ class _$MyDownloaderStatus_FinishedImpl implements MyDownloaderStatus_Finished {
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(dynamic other) {
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$MyDownloaderStatus_FinishedImpl);
|
@ -1,23 +0,0 @@
|
||||
// This file initializes the dynamic library and connects it with the stub
|
||||
// generated by flutter_rust_bridge_codegen.
|
||||
|
||||
import 'dart:ffi';
|
||||
|
||||
import 'bridge_generated.dart';
|
||||
import 'bridge_definitions.dart';
|
||||
export 'bridge_definitions.dart';
|
||||
|
||||
// Re-export the bridge so it is only necessary to import this file.
|
||||
export 'bridge_generated.dart';
|
||||
import 'dart:io' as io;
|
||||
|
||||
|
||||
const _base = 'rust';
|
||||
|
||||
// On MacOS, the dynamic library is not bundled with the binary,
|
||||
// but rather directly **linked** against the binary.
|
||||
final _dylib = io.Platform.isWindows ? '$_base.dll' : 'lib$_base.so';
|
||||
|
||||
final Rust rustFii = RustImpl(io.Platform.isIOS || io.Platform.isMacOS
|
||||
? DynamicLibrary.executable()
|
||||
: DynamicLibrary.open(_dylib));
|
395
lib/common/rust/frb_generated.dart
Normal file
395
lib/common/rust/frb_generated.dart
Normal file
@ -0,0 +1,395 @@
|
||||
// This file is automatically generated, so please do not edit it.
|
||||
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.23.
|
||||
|
||||
// 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/downloader_api.dart';
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'downloader.dart';
|
||||
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<RustLibApi, RustLibApiImpl, RustLibWire> {
|
||||
@internal
|
||||
static final instance = RustLib._();
|
||||
|
||||
RustLib._();
|
||||
|
||||
/// Initialize flutter_rust_bridge
|
||||
static Future<void> 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<RustLibApiImpl, RustLibWire> get apiImplConstructor =>
|
||||
RustLibApiImpl.new;
|
||||
|
||||
@override
|
||||
WireConstructor<RustLibWire> get wireConstructor =>
|
||||
RustLibWire.fromExternalLibrary;
|
||||
|
||||
@override
|
||||
Future<void> executeRustInitializers() async {}
|
||||
|
||||
@override
|
||||
ExternalLibraryLoaderConfig get defaultExternalLibraryLoaderConfig =>
|
||||
kDefaultExternalLibraryLoaderConfig;
|
||||
|
||||
@override
|
||||
String get codegenVersion => '2.0.0-dev.23';
|
||||
|
||||
static const kDefaultExternalLibraryLoaderConfig =
|
||||
ExternalLibraryLoaderConfig(
|
||||
stem: 'rust_lib',
|
||||
ioDirectory: 'rust/target/release/',
|
||||
webPrefix: 'pkg/',
|
||||
);
|
||||
}
|
||||
|
||||
abstract class RustLibApi extends BaseApi {
|
||||
Future<void> cancelDownload({required String id, dynamic hint});
|
||||
|
||||
Stream<DownloadCallbackData> startDownload(
|
||||
{required String url,
|
||||
required String savePath,
|
||||
required String fileName,
|
||||
required int connectionCount,
|
||||
dynamic hint});
|
||||
}
|
||||
|
||||
class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
RustLibApiImpl({
|
||||
required super.handler,
|
||||
required super.wire,
|
||||
required super.generalizedFrbRustBinding,
|
||||
required super.portManager,
|
||||
});
|
||||
|
||||
@override
|
||||
Future<void> cancelDownload({required String id, dynamic hint}) {
|
||||
return handler.executeNormal(NormalTask(
|
||||
callFfi: (port_) {
|
||||
final serializer = SseSerializer(generalizedFrbRustBinding);
|
||||
sse_encode_String(id, serializer);
|
||||
pdeCallFfi(generalizedFrbRustBinding, serializer,
|
||||
funcId: 2, port: port_);
|
||||
},
|
||||
codec: SseCodec(
|
||||
decodeSuccessData: sse_decode_unit,
|
||||
decodeErrorData: null,
|
||||
),
|
||||
constMeta: kCancelDownloadConstMeta,
|
||||
argValues: [id],
|
||||
apiImpl: this,
|
||||
hint: hint,
|
||||
));
|
||||
}
|
||||
|
||||
TaskConstMeta get kCancelDownloadConstMeta => const TaskConstMeta(
|
||||
debugName: "cancel_download",
|
||||
argNames: ["id"],
|
||||
);
|
||||
|
||||
@override
|
||||
Stream<DownloadCallbackData> startDownload(
|
||||
{required String url,
|
||||
required String savePath,
|
||||
required String fileName,
|
||||
required int connectionCount,
|
||||
dynamic hint}) {
|
||||
return handler.executeStream(StreamTask(
|
||||
callFfi: (port_) {
|
||||
final serializer = SseSerializer(generalizedFrbRustBinding);
|
||||
sse_encode_String(url, serializer);
|
||||
sse_encode_String(savePath, serializer);
|
||||
sse_encode_String(fileName, serializer);
|
||||
sse_encode_u_8(connectionCount, serializer);
|
||||
pdeCallFfi(generalizedFrbRustBinding, serializer,
|
||||
funcId: 1, port: port_);
|
||||
},
|
||||
codec: SseCodec(
|
||||
decodeSuccessData: sse_decode_download_callback_data,
|
||||
decodeErrorData: null,
|
||||
),
|
||||
constMeta: kStartDownloadConstMeta,
|
||||
argValues: [url, savePath, fileName, connectionCount],
|
||||
apiImpl: this,
|
||||
hint: hint,
|
||||
));
|
||||
}
|
||||
|
||||
TaskConstMeta get kStartDownloadConstMeta => const TaskConstMeta(
|
||||
debugName: "start_download",
|
||||
argNames: ["url", "savePath", "fileName", "connectionCount"],
|
||||
);
|
||||
|
||||
@protected
|
||||
String dco_decode_String(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
return raw as String;
|
||||
}
|
||||
|
||||
@protected
|
||||
DownloadCallbackData dco_decode_download_callback_data(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
final arr = raw as List<dynamic>;
|
||||
if (arr.length != 5)
|
||||
throw Exception('unexpected arr length: expect 5 but see ${arr.length}');
|
||||
return DownloadCallbackData(
|
||||
id: dco_decode_String(arr[0]),
|
||||
total: dco_decode_u_64(arr[1]),
|
||||
progress: dco_decode_u_64(arr[2]),
|
||||
speed: dco_decode_u_64(arr[3]),
|
||||
status: dco_decode_my_downloader_status(arr[4]),
|
||||
);
|
||||
}
|
||||
|
||||
@protected
|
||||
int dco_decode_i_32(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
return 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
|
||||
MyDownloaderStatus dco_decode_my_downloader_status(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
switch (raw[0]) {
|
||||
case 0:
|
||||
return MyDownloaderStatus_NoStart();
|
||||
case 1:
|
||||
return MyDownloaderStatus_Running();
|
||||
case 2:
|
||||
return MyDownloaderStatus_Pending(
|
||||
dco_decode_my_network_item_pending_type(raw[1]),
|
||||
);
|
||||
case 3:
|
||||
return MyDownloaderStatus_Error(
|
||||
dco_decode_String(raw[1]),
|
||||
);
|
||||
case 4:
|
||||
return MyDownloaderStatus_Finished();
|
||||
default:
|
||||
throw Exception("unreachable");
|
||||
}
|
||||
}
|
||||
|
||||
@protected
|
||||
MyNetworkItemPendingType dco_decode_my_network_item_pending_type(
|
||||
dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
return MyNetworkItemPendingType.values[raw as int];
|
||||
}
|
||||
|
||||
@protected
|
||||
int dco_decode_u_64(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
return dcoDecodeI64OrU64(raw);
|
||||
}
|
||||
|
||||
@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
|
||||
DownloadCallbackData sse_decode_download_callback_data(
|
||||
SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
var var_id = sse_decode_String(deserializer);
|
||||
var var_total = sse_decode_u_64(deserializer);
|
||||
var var_progress = sse_decode_u_64(deserializer);
|
||||
var var_speed = sse_decode_u_64(deserializer);
|
||||
var var_status = sse_decode_my_downloader_status(deserializer);
|
||||
return DownloadCallbackData(
|
||||
id: var_id,
|
||||
total: var_total,
|
||||
progress: var_progress,
|
||||
speed: var_speed,
|
||||
status: var_status);
|
||||
}
|
||||
|
||||
@protected
|
||||
int sse_decode_i_32(SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
return deserializer.buffer.getInt32();
|
||||
}
|
||||
|
||||
@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
|
||||
MyDownloaderStatus sse_decode_my_downloader_status(
|
||||
SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
|
||||
var tag_ = sse_decode_i_32(deserializer);
|
||||
switch (tag_) {
|
||||
case 0:
|
||||
return MyDownloaderStatus_NoStart();
|
||||
case 1:
|
||||
return MyDownloaderStatus_Running();
|
||||
case 2:
|
||||
var var_field0 = sse_decode_my_network_item_pending_type(deserializer);
|
||||
return MyDownloaderStatus_Pending(var_field0);
|
||||
case 3:
|
||||
var var_field0 = sse_decode_String(deserializer);
|
||||
return MyDownloaderStatus_Error(var_field0);
|
||||
case 4:
|
||||
return MyDownloaderStatus_Finished();
|
||||
default:
|
||||
throw UnimplementedError('');
|
||||
}
|
||||
}
|
||||
|
||||
@protected
|
||||
MyNetworkItemPendingType sse_decode_my_network_item_pending_type(
|
||||
SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
var inner = sse_decode_i_32(deserializer);
|
||||
return MyNetworkItemPendingType.values[inner];
|
||||
}
|
||||
|
||||
@protected
|
||||
int sse_decode_u_64(SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
return deserializer.buffer.getUint64();
|
||||
}
|
||||
|
||||
@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_download_callback_data(
|
||||
DownloadCallbackData self, SseSerializer serializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
sse_encode_String(self.id, serializer);
|
||||
sse_encode_u_64(self.total, serializer);
|
||||
sse_encode_u_64(self.progress, serializer);
|
||||
sse_encode_u_64(self.speed, serializer);
|
||||
sse_encode_my_downloader_status(self.status, 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_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_my_downloader_status(
|
||||
MyDownloaderStatus self, SseSerializer serializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
switch (self) {
|
||||
case MyDownloaderStatus_NoStart():
|
||||
sse_encode_i_32(0, serializer);
|
||||
case MyDownloaderStatus_Running():
|
||||
sse_encode_i_32(1, serializer);
|
||||
case MyDownloaderStatus_Pending(field0: final field0):
|
||||
sse_encode_i_32(2, serializer);
|
||||
sse_encode_my_network_item_pending_type(field0, serializer);
|
||||
case MyDownloaderStatus_Error(field0: final field0):
|
||||
sse_encode_i_32(3, serializer);
|
||||
sse_encode_String(field0, serializer);
|
||||
case MyDownloaderStatus_Finished():
|
||||
sse_encode_i_32(4, serializer);
|
||||
}
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_my_network_item_pending_type(
|
||||
MyNetworkItemPendingType self, SseSerializer serializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
sse_encode_i_32(self.index, serializer);
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_u_64(int self, SseSerializer serializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
serializer.buffer.putUint64(self);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
130
lib/common/rust/frb_generated.io.dart
Normal file
130
lib/common/rust/frb_generated.io.dart
Normal file
@ -0,0 +1,130 @@
|
||||
// This file is automatically generated, so please do not edit it.
|
||||
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.23.
|
||||
|
||||
// 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/downloader_api.dart';
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:ffi' as ffi;
|
||||
import 'downloader.dart';
|
||||
import 'frb_generated.dart';
|
||||
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated_io.dart';
|
||||
|
||||
abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
||||
RustLibApiImplPlatform({
|
||||
required super.handler,
|
||||
required super.wire,
|
||||
required super.generalizedFrbRustBinding,
|
||||
required super.portManager,
|
||||
});
|
||||
|
||||
@protected
|
||||
String dco_decode_String(dynamic raw);
|
||||
|
||||
@protected
|
||||
DownloadCallbackData dco_decode_download_callback_data(dynamic raw);
|
||||
|
||||
@protected
|
||||
int dco_decode_i_32(dynamic raw);
|
||||
|
||||
@protected
|
||||
Uint8List dco_decode_list_prim_u_8_strict(dynamic raw);
|
||||
|
||||
@protected
|
||||
MyDownloaderStatus dco_decode_my_downloader_status(dynamic raw);
|
||||
|
||||
@protected
|
||||
MyNetworkItemPendingType dco_decode_my_network_item_pending_type(dynamic raw);
|
||||
|
||||
@protected
|
||||
int dco_decode_u_64(dynamic raw);
|
||||
|
||||
@protected
|
||||
int dco_decode_u_8(dynamic raw);
|
||||
|
||||
@protected
|
||||
void dco_decode_unit(dynamic raw);
|
||||
|
||||
@protected
|
||||
String sse_decode_String(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
DownloadCallbackData sse_decode_download_callback_data(
|
||||
SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
int sse_decode_i_32(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
Uint8List sse_decode_list_prim_u_8_strict(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
MyDownloaderStatus sse_decode_my_downloader_status(
|
||||
SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
MyNetworkItemPendingType sse_decode_my_network_item_pending_type(
|
||||
SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
int sse_decode_u_64(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
int sse_decode_u_8(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
void sse_decode_unit(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
bool sse_decode_bool(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_String(String self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_download_callback_data(
|
||||
DownloadCallbackData self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_i_32(int self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_list_prim_u_8_strict(
|
||||
Uint8List self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_my_downloader_status(
|
||||
MyDownloaderStatus self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_my_network_item_pending_type(
|
||||
MyNetworkItemPendingType self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_u_64(int self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_u_8(int self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_unit(void self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_bool(bool self, SseSerializer serializer);
|
||||
}
|
||||
|
||||
// Section: wire_class
|
||||
|
||||
class RustLibWire implements BaseWire {
|
||||
factory RustLibWire.fromExternalLibrary(ExternalLibrary lib) =>
|
||||
RustLibWire(lib.ffiDynamicLibrary);
|
||||
|
||||
/// Holds the symbol lookup function.
|
||||
final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
|
||||
_lookup;
|
||||
|
||||
/// The symbols are looked up in [dynamicLibrary].
|
||||
RustLibWire(ffi.DynamicLibrary dynamicLibrary)
|
||||
: _lookup = dynamicLibrary.lookup;
|
||||
}
|
133
lib/common/rust/frb_generated.web.dart
Normal file
133
lib/common/rust/frb_generated.web.dart
Normal file
@ -0,0 +1,133 @@
|
||||
// This file is automatically generated, so please do not edit it.
|
||||
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.23.
|
||||
|
||||
// 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/downloader_api.dart';
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'downloader.dart';
|
||||
import 'frb_generated.dart';
|
||||
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated_web.dart';
|
||||
|
||||
abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
||||
RustLibApiImplPlatform({
|
||||
required super.handler,
|
||||
required super.wire,
|
||||
required super.generalizedFrbRustBinding,
|
||||
required super.portManager,
|
||||
});
|
||||
|
||||
@protected
|
||||
String dco_decode_String(dynamic raw);
|
||||
|
||||
@protected
|
||||
DownloadCallbackData dco_decode_download_callback_data(dynamic raw);
|
||||
|
||||
@protected
|
||||
int dco_decode_i_32(dynamic raw);
|
||||
|
||||
@protected
|
||||
Uint8List dco_decode_list_prim_u_8_strict(dynamic raw);
|
||||
|
||||
@protected
|
||||
MyDownloaderStatus dco_decode_my_downloader_status(dynamic raw);
|
||||
|
||||
@protected
|
||||
MyNetworkItemPendingType dco_decode_my_network_item_pending_type(dynamic raw);
|
||||
|
||||
@protected
|
||||
int dco_decode_u_64(dynamic raw);
|
||||
|
||||
@protected
|
||||
int dco_decode_u_8(dynamic raw);
|
||||
|
||||
@protected
|
||||
void dco_decode_unit(dynamic raw);
|
||||
|
||||
@protected
|
||||
String sse_decode_String(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
DownloadCallbackData sse_decode_download_callback_data(
|
||||
SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
int sse_decode_i_32(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
Uint8List sse_decode_list_prim_u_8_strict(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
MyDownloaderStatus sse_decode_my_downloader_status(
|
||||
SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
MyNetworkItemPendingType sse_decode_my_network_item_pending_type(
|
||||
SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
int sse_decode_u_64(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
int sse_decode_u_8(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
void sse_decode_unit(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
bool sse_decode_bool(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_String(String self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_download_callback_data(
|
||||
DownloadCallbackData self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_i_32(int self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_list_prim_u_8_strict(
|
||||
Uint8List self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_my_downloader_status(
|
||||
MyDownloaderStatus self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_my_network_item_pending_type(
|
||||
MyNetworkItemPendingType self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_u_64(int self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_u_8(int self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_unit(void self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_bool(bool self, SseSerializer serializer);
|
||||
}
|
||||
|
||||
// Section: wire_class
|
||||
|
||||
class RustLibWire implements BaseWire {
|
||||
RustLibWire.fromExternalLibrary(ExternalLibrary lib);
|
||||
}
|
||||
|
||||
@JS('wasm_bindgen')
|
||||
external RustLibWasmModule get wasmModule;
|
||||
|
||||
@JS()
|
||||
@anonymous
|
||||
class RustLibWasmModule implements WasmModule {
|
||||
@override
|
||||
external Object /* Promise */ call([String? moduleName]);
|
||||
|
||||
@override
|
||||
external RustLibWasmModule bind(dynamic thisArg, String moduleName);
|
||||
}
|
Reference in New Issue
Block a user