mirror of
https://mirror.ghproxy.com/https://github.com/StarCitizenToolBox/app.git
synced 2024-12-23 19:23:43 +08:00
882 lines
28 KiB
Dart
882 lines
28 KiB
Dart
// 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 'api/http_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 'http_package.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',
|
|
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});
|
|
|
|
Future<List<String>> dnsLookupTxt({required String host, dynamic hint});
|
|
|
|
Future<RustHttpResponse> fetch(
|
|
{required MyMethod method,
|
|
required String url,
|
|
Map<String, String>? headers,
|
|
Uint8List? inputData,
|
|
dynamic hint});
|
|
|
|
Future<void> setDefaultHeader(
|
|
{required Map<String, String> headers, dynamic hint});
|
|
|
|
RustArcIncrementStrongCountFnType
|
|
get rust_arc_increment_strong_count_ReqwestVersion;
|
|
|
|
RustArcDecrementStrongCountFnType
|
|
get rust_arc_decrement_strong_count_ReqwestVersion;
|
|
|
|
CrossPlatformFinalizerArg
|
|
get rust_arc_decrement_strong_count_ReqwestVersionPtr;
|
|
}
|
|
|
|
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"],
|
|
);
|
|
|
|
@override
|
|
Future<List<String>> dnsLookupTxt({required String host, dynamic hint}) {
|
|
return handler.executeNormal(NormalTask(
|
|
callFfi: (port_) {
|
|
final serializer = SseSerializer(generalizedFrbRustBinding);
|
|
sse_encode_String(host, serializer);
|
|
pdeCallFfi(generalizedFrbRustBinding, serializer,
|
|
funcId: 5, port: port_);
|
|
},
|
|
codec: SseCodec(
|
|
decodeSuccessData: sse_decode_list_String,
|
|
decodeErrorData: null,
|
|
),
|
|
constMeta: kDnsLookupTxtConstMeta,
|
|
argValues: [host],
|
|
apiImpl: this,
|
|
hint: hint,
|
|
));
|
|
}
|
|
|
|
TaskConstMeta get kDnsLookupTxtConstMeta => const TaskConstMeta(
|
|
debugName: "dns_lookup_txt",
|
|
argNames: ["host"],
|
|
);
|
|
|
|
@override
|
|
Future<RustHttpResponse> fetch(
|
|
{required MyMethod method,
|
|
required String url,
|
|
Map<String, String>? headers,
|
|
Uint8List? inputData,
|
|
dynamic hint}) {
|
|
return handler.executeNormal(NormalTask(
|
|
callFfi: (port_) {
|
|
final serializer = SseSerializer(generalizedFrbRustBinding);
|
|
sse_encode_my_method(method, serializer);
|
|
sse_encode_String(url, serializer);
|
|
sse_encode_opt_Map_String_String(headers, serializer);
|
|
sse_encode_opt_list_prim_u_8_strict(inputData, serializer);
|
|
pdeCallFfi(generalizedFrbRustBinding, serializer,
|
|
funcId: 4, port: port_);
|
|
},
|
|
codec: SseCodec(
|
|
decodeSuccessData: sse_decode_rust_http_response,
|
|
decodeErrorData: null,
|
|
),
|
|
constMeta: kFetchConstMeta,
|
|
argValues: [method, url, headers, inputData],
|
|
apiImpl: this,
|
|
hint: hint,
|
|
));
|
|
}
|
|
|
|
TaskConstMeta get kFetchConstMeta => const TaskConstMeta(
|
|
debugName: "fetch",
|
|
argNames: ["method", "url", "headers", "inputData"],
|
|
);
|
|
|
|
@override
|
|
Future<void> setDefaultHeader(
|
|
{required Map<String, String> headers, dynamic hint}) {
|
|
return handler.executeNormal(NormalTask(
|
|
callFfi: (port_) {
|
|
final serializer = SseSerializer(generalizedFrbRustBinding);
|
|
sse_encode_Map_String_String(headers, serializer);
|
|
pdeCallFfi(generalizedFrbRustBinding, serializer,
|
|
funcId: 3, port: port_);
|
|
},
|
|
codec: SseCodec(
|
|
decodeSuccessData: sse_decode_unit,
|
|
decodeErrorData: null,
|
|
),
|
|
constMeta: kSetDefaultHeaderConstMeta,
|
|
argValues: [headers],
|
|
apiImpl: this,
|
|
hint: hint,
|
|
));
|
|
}
|
|
|
|
TaskConstMeta get kSetDefaultHeaderConstMeta => const TaskConstMeta(
|
|
debugName: "set_default_header",
|
|
argNames: ["headers"],
|
|
);
|
|
|
|
RustArcIncrementStrongCountFnType
|
|
get rust_arc_increment_strong_count_ReqwestVersion => wire
|
|
.rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockreqwestVersion;
|
|
|
|
RustArcDecrementStrongCountFnType
|
|
get rust_arc_decrement_strong_count_ReqwestVersion => wire
|
|
.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockreqwestVersion;
|
|
|
|
@protected
|
|
ReqwestVersion
|
|
dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockreqwestVersion(
|
|
dynamic raw) {
|
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
|
return ReqwestVersion.dcoDecode(raw as List<dynamic>);
|
|
}
|
|
|
|
@protected
|
|
Map<String, String> dco_decode_Map_String_String(dynamic raw) {
|
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
|
return Map.fromEntries(dco_decode_list_record_string_string(raw)
|
|
.map((e) => MapEntry(e.$1, e.$2)));
|
|
}
|
|
|
|
@protected
|
|
ReqwestVersion
|
|
dco_decode_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockreqwestVersion(
|
|
dynamic raw) {
|
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
|
return ReqwestVersion.dcoDecode(raw as List<dynamic>);
|
|
}
|
|
|
|
@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_box_autoadd_u_64(dynamic raw) {
|
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
|
return dco_decode_u_64(raw);
|
|
}
|
|
|
|
@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
|
|
List<String> dco_decode_list_String(dynamic raw) {
|
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
|
return (raw as List<dynamic>).map(dco_decode_String).toList();
|
|
}
|
|
|
|
@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
|
|
List<(String, String)> dco_decode_list_record_string_string(dynamic raw) {
|
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
|
return (raw as List<dynamic>).map(dco_decode_record_string_string).toList();
|
|
}
|
|
|
|
@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
|
|
MyMethod dco_decode_my_method(dynamic raw) {
|
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
|
return MyMethod.values[raw as int];
|
|
}
|
|
|
|
@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
|
|
Map<String, String>? dco_decode_opt_Map_String_String(dynamic raw) {
|
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
|
return raw == null ? null : dco_decode_Map_String_String(raw);
|
|
}
|
|
|
|
@protected
|
|
int? dco_decode_opt_box_autoadd_u_64(dynamic raw) {
|
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
|
return raw == null ? null : dco_decode_box_autoadd_u_64(raw);
|
|
}
|
|
|
|
@protected
|
|
Uint8List? dco_decode_opt_list_prim_u_8_strict(dynamic raw) {
|
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
|
return raw == null ? null : dco_decode_list_prim_u_8_strict(raw);
|
|
}
|
|
|
|
@protected
|
|
(String, String) dco_decode_record_string_string(dynamic raw) {
|
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
|
final arr = raw as List<dynamic>;
|
|
if (arr.length != 2) {
|
|
throw Exception('Expected 2 elements, got ${arr.length}');
|
|
}
|
|
return (
|
|
dco_decode_String(arr[0]),
|
|
dco_decode_String(arr[1]),
|
|
);
|
|
}
|
|
|
|
@protected
|
|
RustHttpResponse dco_decode_rust_http_response(dynamic raw) {
|
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
|
final arr = raw as List<dynamic>;
|
|
if (arr.length != 7)
|
|
throw Exception('unexpected arr length: expect 7 but see ${arr.length}');
|
|
return RustHttpResponse(
|
|
statusCode: dco_decode_u_16(arr[0]),
|
|
headers: dco_decode_Map_String_String(arr[1]),
|
|
url: dco_decode_String(arr[2]),
|
|
contentLength: dco_decode_opt_box_autoadd_u_64(arr[3]),
|
|
version:
|
|
dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockreqwestVersion(
|
|
arr[4]),
|
|
remoteAddr: dco_decode_String(arr[5]),
|
|
data: dco_decode_opt_list_prim_u_8_strict(arr[6]),
|
|
);
|
|
}
|
|
|
|
@protected
|
|
int dco_decode_u_16(dynamic raw) {
|
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
|
return 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
|
|
int dco_decode_usize(dynamic raw) {
|
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
|
return dcoDecodeI64OrU64(raw);
|
|
}
|
|
|
|
@protected
|
|
ReqwestVersion
|
|
sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockreqwestVersion(
|
|
SseDeserializer deserializer) {
|
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
|
return ReqwestVersion.sseDecode(
|
|
sse_decode_usize(deserializer), sse_decode_i_32(deserializer));
|
|
}
|
|
|
|
@protected
|
|
Map<String, String> sse_decode_Map_String_String(
|
|
SseDeserializer deserializer) {
|
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
|
var inner = sse_decode_list_record_string_string(deserializer);
|
|
return Map.fromEntries(inner.map((e) => MapEntry(e.$1, e.$2)));
|
|
}
|
|
|
|
@protected
|
|
ReqwestVersion
|
|
sse_decode_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockreqwestVersion(
|
|
SseDeserializer deserializer) {
|
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
|
return ReqwestVersion.sseDecode(
|
|
sse_decode_usize(deserializer), sse_decode_i_32(deserializer));
|
|
}
|
|
|
|
@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_box_autoadd_u_64(SseDeserializer deserializer) {
|
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
|
return (sse_decode_u_64(deserializer));
|
|
}
|
|
|
|
@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
|
|
List<String> sse_decode_list_String(SseDeserializer deserializer) {
|
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
|
|
|
var len_ = sse_decode_i_32(deserializer);
|
|
var ans_ = <String>[];
|
|
for (var idx_ = 0; idx_ < len_; ++idx_) {
|
|
ans_.add(sse_decode_String(deserializer));
|
|
}
|
|
return ans_;
|
|
}
|
|
|
|
@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
|
|
List<(String, String)> sse_decode_list_record_string_string(
|
|
SseDeserializer deserializer) {
|
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
|
|
|
var len_ = sse_decode_i_32(deserializer);
|
|
var ans_ = <(String, String)>[];
|
|
for (var idx_ = 0; idx_ < len_; ++idx_) {
|
|
ans_.add(sse_decode_record_string_string(deserializer));
|
|
}
|
|
return ans_;
|
|
}
|
|
|
|
@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
|
|
MyMethod sse_decode_my_method(SseDeserializer deserializer) {
|
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
|
var inner = sse_decode_i_32(deserializer);
|
|
return MyMethod.values[inner];
|
|
}
|
|
|
|
@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
|
|
Map<String, String>? sse_decode_opt_Map_String_String(
|
|
SseDeserializer deserializer) {
|
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
|
|
|
if (sse_decode_bool(deserializer)) {
|
|
return (sse_decode_Map_String_String(deserializer));
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
@protected
|
|
int? sse_decode_opt_box_autoadd_u_64(SseDeserializer deserializer) {
|
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
|
|
|
if (sse_decode_bool(deserializer)) {
|
|
return (sse_decode_box_autoadd_u_64(deserializer));
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
@protected
|
|
Uint8List? sse_decode_opt_list_prim_u_8_strict(SseDeserializer deserializer) {
|
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
|
|
|
if (sse_decode_bool(deserializer)) {
|
|
return (sse_decode_list_prim_u_8_strict(deserializer));
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
@protected
|
|
(String, String) sse_decode_record_string_string(
|
|
SseDeserializer deserializer) {
|
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
|
var var_field0 = sse_decode_String(deserializer);
|
|
var var_field1 = sse_decode_String(deserializer);
|
|
return (var_field0, var_field1);
|
|
}
|
|
|
|
@protected
|
|
RustHttpResponse sse_decode_rust_http_response(SseDeserializer deserializer) {
|
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
|
var var_statusCode = sse_decode_u_16(deserializer);
|
|
var var_headers = sse_decode_Map_String_String(deserializer);
|
|
var var_url = sse_decode_String(deserializer);
|
|
var var_contentLength = sse_decode_opt_box_autoadd_u_64(deserializer);
|
|
var var_version =
|
|
sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockreqwestVersion(
|
|
deserializer);
|
|
var var_remoteAddr = sse_decode_String(deserializer);
|
|
var var_data = sse_decode_opt_list_prim_u_8_strict(deserializer);
|
|
return RustHttpResponse(
|
|
statusCode: var_statusCode,
|
|
headers: var_headers,
|
|
url: var_url,
|
|
contentLength: var_contentLength,
|
|
version: var_version,
|
|
remoteAddr: var_remoteAddr,
|
|
data: var_data);
|
|
}
|
|
|
|
@protected
|
|
int sse_decode_u_16(SseDeserializer deserializer) {
|
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
|
return deserializer.buffer.getUint16();
|
|
}
|
|
|
|
@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
|
|
int sse_decode_usize(SseDeserializer deserializer) {
|
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
|
return deserializer.buffer.getUint64();
|
|
}
|
|
|
|
@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_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockreqwestVersion(
|
|
ReqwestVersion self, SseSerializer serializer) {
|
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
|
sse_encode_usize(self.sseEncode(move: true), serializer);
|
|
}
|
|
|
|
@protected
|
|
void sse_encode_Map_String_String(
|
|
Map<String, String> self, SseSerializer serializer) {
|
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
|
sse_encode_list_record_string_string(
|
|
self.entries.map((e) => (e.key, e.value)).toList(), serializer);
|
|
}
|
|
|
|
@protected
|
|
void
|
|
sse_encode_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockreqwestVersion(
|
|
ReqwestVersion self, SseSerializer serializer) {
|
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
|
sse_encode_usize(self.sseEncode(move: null), serializer);
|
|
}
|
|
|
|
@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_box_autoadd_u_64(int self, SseSerializer serializer) {
|
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
|
sse_encode_u_64(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_String(List<String> self, SseSerializer serializer) {
|
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
|
sse_encode_i_32(self.length, serializer);
|
|
for (final item in self) {
|
|
sse_encode_String(item, 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_list_record_string_string(
|
|
List<(String, String)> self, SseSerializer serializer) {
|
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
|
sse_encode_i_32(self.length, serializer);
|
|
for (final item in self) {
|
|
sse_encode_record_string_string(item, serializer);
|
|
}
|
|
}
|
|
|
|
@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_method(MyMethod self, SseSerializer serializer) {
|
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
|
sse_encode_i_32(self.index, 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_opt_Map_String_String(
|
|
Map<String, String>? self, SseSerializer serializer) {
|
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
|
|
|
sse_encode_bool(self != null, serializer);
|
|
if (self != null) {
|
|
sse_encode_Map_String_String(self, serializer);
|
|
}
|
|
}
|
|
|
|
@protected
|
|
void sse_encode_opt_box_autoadd_u_64(int? 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_u_64(self, serializer);
|
|
}
|
|
}
|
|
|
|
@protected
|
|
void sse_encode_opt_list_prim_u_8_strict(
|
|
Uint8List? self, SseSerializer serializer) {
|
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
|
|
|
sse_encode_bool(self != null, serializer);
|
|
if (self != null) {
|
|
sse_encode_list_prim_u_8_strict(self, serializer);
|
|
}
|
|
}
|
|
|
|
@protected
|
|
void sse_encode_record_string_string(
|
|
(String, String) self, SseSerializer serializer) {
|
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
|
sse_encode_String(self.$1, serializer);
|
|
sse_encode_String(self.$2, serializer);
|
|
}
|
|
|
|
@protected
|
|
void sse_encode_rust_http_response(
|
|
RustHttpResponse self, SseSerializer serializer) {
|
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
|
sse_encode_u_16(self.statusCode, serializer);
|
|
sse_encode_Map_String_String(self.headers, serializer);
|
|
sse_encode_String(self.url, serializer);
|
|
sse_encode_opt_box_autoadd_u_64(self.contentLength, serializer);
|
|
sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockreqwestVersion(
|
|
self.version, serializer);
|
|
sse_encode_String(self.remoteAddr, serializer);
|
|
sse_encode_opt_list_prim_u_8_strict(self.data, serializer);
|
|
}
|
|
|
|
@protected
|
|
void sse_encode_u_16(int self, SseSerializer serializer) {
|
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
|
serializer.buffer.putUint16(self);
|
|
}
|
|
|
|
@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_usize(int self, SseSerializer serializer) {
|
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
|
serializer.buffer.putUint64(self);
|
|
}
|
|
|
|
@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);
|
|
}
|
|
}
|