mirror of
https://mirror.ghproxy.com/https://github.com/StarCitizenToolBox/app.git
synced 2024-12-22 23:23:43 +08:00
feat: RsProcess
This commit is contained in:
parent
90ff0025d6
commit
603ef46f10
@ -1,18 +0,0 @@
|
|||||||
// This file is automatically generated, so please do not edit it.
|
|
||||||
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.32.
|
|
||||||
|
|
||||||
// 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';
|
|
||||||
|
|
||||||
Stream<String> startProcess(
|
|
||||||
{required String executable,
|
|
||||||
required List<String> arguments,
|
|
||||||
required String workingDirectory,
|
|
||||||
dynamic hint}) =>
|
|
||||||
RustLib.instance.api.startProcess(
|
|
||||||
executable: executable,
|
|
||||||
arguments: arguments,
|
|
||||||
workingDirectory: workingDirectory,
|
|
||||||
hint: hint);
|
|
74
lib/common/rust/api/rs_process.dart
Normal file
74
lib/common/rust/api/rs_process.dart
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
// This file is automatically generated, so please do not edit it.
|
||||||
|
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.32.
|
||||||
|
|
||||||
|
// 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';
|
||||||
|
|
||||||
|
// Rust type: RustOpaqueNom<flutter_rust_bridge::for_generated::rust_async::RwLock<RsProcess>>
|
||||||
|
@sealed
|
||||||
|
class RsProcess extends RustOpaque {
|
||||||
|
RsProcess.dcoDecode(List<dynamic> wire) : super.dcoDecode(wire, _kStaticData);
|
||||||
|
|
||||||
|
RsProcess.sseDecode(int ptr, int externalSizeOnNative)
|
||||||
|
: super.sseDecode(ptr, externalSizeOnNative, _kStaticData);
|
||||||
|
|
||||||
|
static final _kStaticData = RustArcStaticData(
|
||||||
|
rustArcIncrementStrongCount:
|
||||||
|
RustLib.instance.api.rust_arc_increment_strong_count_RsProcess,
|
||||||
|
rustArcDecrementStrongCount:
|
||||||
|
RustLib.instance.api.rust_arc_decrement_strong_count_RsProcess,
|
||||||
|
rustArcDecrementStrongCountPtr:
|
||||||
|
RustLib.instance.api.rust_arc_decrement_strong_count_RsProcessPtr,
|
||||||
|
);
|
||||||
|
|
||||||
|
int? getPid({dynamic hint}) =>
|
||||||
|
RustLib.instance.api.rsProcessGetPid(that: this, hint: hint);
|
||||||
|
|
||||||
|
factory RsProcess({dynamic hint}) =>
|
||||||
|
RustLib.instance.api.rsProcessNew(hint: hint);
|
||||||
|
|
||||||
|
Stream<RsProcessStreamData> start(
|
||||||
|
{required String executable,
|
||||||
|
required List<String> arguments,
|
||||||
|
required String workingDirectory,
|
||||||
|
dynamic hint}) =>
|
||||||
|
RustLib.instance.api.rsProcessStart(
|
||||||
|
that: this,
|
||||||
|
executable: executable,
|
||||||
|
arguments: arguments,
|
||||||
|
workingDirectory: workingDirectory,
|
||||||
|
hint: hint);
|
||||||
|
|
||||||
|
Future<void> write({required String data, dynamic hint}) =>
|
||||||
|
RustLib.instance.api.rsProcessWrite(that: this, data: data, hint: hint);
|
||||||
|
}
|
||||||
|
|
||||||
|
class RsProcessStreamData {
|
||||||
|
final RsProcessStreamDataType dataType;
|
||||||
|
final String data;
|
||||||
|
|
||||||
|
const RsProcessStreamData({
|
||||||
|
required this.dataType,
|
||||||
|
required this.data,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => dataType.hashCode ^ data.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
other is RsProcessStreamData &&
|
||||||
|
runtimeType == other.runtimeType &&
|
||||||
|
dataType == other.dataType &&
|
||||||
|
data == other.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum RsProcessStreamDataType {
|
||||||
|
output,
|
||||||
|
error,
|
||||||
|
exit,
|
||||||
|
;
|
||||||
|
}
|
@ -4,7 +4,7 @@
|
|||||||
// 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
|
// 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/http_api.dart';
|
import 'api/http_api.dart';
|
||||||
import 'api/process_api.dart';
|
import 'api/rs_process.dart';
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'frb_generated.io.dart' if (dart.library.html) 'frb_generated.web.dart';
|
import 'frb_generated.io.dart' if (dart.library.html) 'frb_generated.web.dart';
|
||||||
@ -56,7 +56,7 @@ class RustLib extends BaseEntrypoint<RustLibApi, RustLibApiImpl, RustLibWire> {
|
|||||||
String get codegenVersion => '2.0.0-dev.32';
|
String get codegenVersion => '2.0.0-dev.32';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get rustContentHash => 593879172;
|
int get rustContentHash => 333909092;
|
||||||
|
|
||||||
static const kDefaultExternalLibraryLoaderConfig =
|
static const kDefaultExternalLibraryLoaderConfig =
|
||||||
ExternalLibraryLoaderConfig(
|
ExternalLibraryLoaderConfig(
|
||||||
@ -82,11 +82,27 @@ abstract class RustLibApi extends BaseApi {
|
|||||||
Future<void> setDefaultHeader(
|
Future<void> setDefaultHeader(
|
||||||
{required Map<String, String> headers, dynamic hint});
|
{required Map<String, String> headers, dynamic hint});
|
||||||
|
|
||||||
Stream<String> startProcess(
|
int? rsProcessGetPid({required RsProcess that, dynamic hint});
|
||||||
{required String executable,
|
|
||||||
|
RsProcess rsProcessNew({dynamic hint});
|
||||||
|
|
||||||
|
Stream<RsProcessStreamData> rsProcessStart(
|
||||||
|
{required RsProcess that,
|
||||||
|
required String executable,
|
||||||
required List<String> arguments,
|
required List<String> arguments,
|
||||||
required String workingDirectory,
|
required String workingDirectory,
|
||||||
dynamic hint});
|
dynamic hint});
|
||||||
|
|
||||||
|
Future<void> rsProcessWrite(
|
||||||
|
{required RsProcess that, required String data, dynamic hint});
|
||||||
|
|
||||||
|
RustArcIncrementStrongCountFnType
|
||||||
|
get rust_arc_increment_strong_count_RsProcess;
|
||||||
|
|
||||||
|
RustArcDecrementStrongCountFnType
|
||||||
|
get rust_arc_decrement_strong_count_RsProcess;
|
||||||
|
|
||||||
|
CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_RsProcessPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||||
@ -201,43 +217,160 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Stream<String> startProcess(
|
int? rsProcessGetPid({required RsProcess that, dynamic hint}) {
|
||||||
{required String executable,
|
return handler.executeSync(SyncTask(
|
||||||
|
callFfi: () {
|
||||||
|
var arg0 =
|
||||||
|
cst_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
that);
|
||||||
|
return wire.wire_RsProcess_get_pid(arg0);
|
||||||
|
},
|
||||||
|
codec: DcoCodec(
|
||||||
|
decodeSuccessData: dco_decode_opt_box_autoadd_u_32,
|
||||||
|
decodeErrorData: null,
|
||||||
|
),
|
||||||
|
constMeta: kRsProcessGetPidConstMeta,
|
||||||
|
argValues: [that],
|
||||||
|
apiImpl: this,
|
||||||
|
hint: hint,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
TaskConstMeta get kRsProcessGetPidConstMeta => const TaskConstMeta(
|
||||||
|
debugName: "RsProcess_get_pid",
|
||||||
|
argNames: ["that"],
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
RsProcess rsProcessNew({dynamic hint}) {
|
||||||
|
return handler.executeSync(SyncTask(
|
||||||
|
callFfi: () {
|
||||||
|
return wire.wire_RsProcess_new();
|
||||||
|
},
|
||||||
|
codec: DcoCodec(
|
||||||
|
decodeSuccessData:
|
||||||
|
dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess,
|
||||||
|
decodeErrorData: null,
|
||||||
|
),
|
||||||
|
constMeta: kRsProcessNewConstMeta,
|
||||||
|
argValues: [],
|
||||||
|
apiImpl: this,
|
||||||
|
hint: hint,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
TaskConstMeta get kRsProcessNewConstMeta => const TaskConstMeta(
|
||||||
|
debugName: "RsProcess_new",
|
||||||
|
argNames: [],
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Stream<RsProcessStreamData> rsProcessStart(
|
||||||
|
{required RsProcess that,
|
||||||
|
required String executable,
|
||||||
required List<String> arguments,
|
required List<String> arguments,
|
||||||
required String workingDirectory,
|
required String workingDirectory,
|
||||||
dynamic hint}) {
|
dynamic hint}) {
|
||||||
final streamSink = RustStreamSink<String>();
|
final streamSink = RustStreamSink<RsProcessStreamData>();
|
||||||
unawaited(handler.executeNormal(NormalTask(
|
unawaited(handler.executeNormal(NormalTask(
|
||||||
callFfi: (port_) {
|
callFfi: (port_) {
|
||||||
var arg0 = cst_encode_String(executable);
|
var arg0 =
|
||||||
var arg1 = cst_encode_list_String(arguments);
|
cst_encode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
var arg2 = cst_encode_String(workingDirectory);
|
that);
|
||||||
var arg3 = cst_encode_StreamSink_String_Dco(streamSink);
|
var arg1 = cst_encode_String(executable);
|
||||||
return wire.wire_start_process(port_, arg0, arg1, arg2, arg3);
|
var arg2 = cst_encode_list_String(arguments);
|
||||||
|
var arg3 = cst_encode_String(workingDirectory);
|
||||||
|
var arg4 = cst_encode_StreamSink_rs_process_stream_data_Dco(streamSink);
|
||||||
|
return wire.wire_RsProcess_start(port_, arg0, arg1, arg2, arg3, arg4);
|
||||||
},
|
},
|
||||||
codec: DcoCodec(
|
codec: DcoCodec(
|
||||||
decodeSuccessData: dco_decode_unit,
|
decodeSuccessData: dco_decode_unit,
|
||||||
decodeErrorData: null,
|
decodeErrorData: null,
|
||||||
),
|
),
|
||||||
constMeta: kStartProcessConstMeta,
|
constMeta: kRsProcessStartConstMeta,
|
||||||
argValues: [executable, arguments, workingDirectory, streamSink],
|
argValues: [that, executable, arguments, workingDirectory, streamSink],
|
||||||
apiImpl: this,
|
apiImpl: this,
|
||||||
hint: hint,
|
hint: hint,
|
||||||
)));
|
)));
|
||||||
return streamSink.stream;
|
return streamSink.stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskConstMeta get kStartProcessConstMeta => const TaskConstMeta(
|
TaskConstMeta get kRsProcessStartConstMeta => const TaskConstMeta(
|
||||||
debugName: "start_process",
|
debugName: "RsProcess_start",
|
||||||
argNames: ["executable", "arguments", "workingDirectory", "streamSink"],
|
argNames: [
|
||||||
|
"that",
|
||||||
|
"executable",
|
||||||
|
"arguments",
|
||||||
|
"workingDirectory",
|
||||||
|
"streamSink"
|
||||||
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> rsProcessWrite(
|
||||||
|
{required RsProcess that, required String data, dynamic hint}) {
|
||||||
|
return handler.executeNormal(NormalTask(
|
||||||
|
callFfi: (port_) {
|
||||||
|
var arg0 =
|
||||||
|
cst_encode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
that);
|
||||||
|
var arg1 = cst_encode_String(data);
|
||||||
|
return wire.wire_RsProcess_write(port_, arg0, arg1);
|
||||||
|
},
|
||||||
|
codec: DcoCodec(
|
||||||
|
decodeSuccessData: dco_decode_unit,
|
||||||
|
decodeErrorData: null,
|
||||||
|
),
|
||||||
|
constMeta: kRsProcessWriteConstMeta,
|
||||||
|
argValues: [that, data],
|
||||||
|
apiImpl: this,
|
||||||
|
hint: hint,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
TaskConstMeta get kRsProcessWriteConstMeta => const TaskConstMeta(
|
||||||
|
debugName: "RsProcess_write",
|
||||||
|
argNames: ["that", "data"],
|
||||||
|
);
|
||||||
|
|
||||||
|
RustArcIncrementStrongCountFnType
|
||||||
|
get rust_arc_increment_strong_count_RsProcess => wire
|
||||||
|
.rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess;
|
||||||
|
|
||||||
|
RustArcDecrementStrongCountFnType
|
||||||
|
get rust_arc_decrement_strong_count_RsProcess => wire
|
||||||
|
.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess;
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
AnyhowException dco_decode_AnyhowException(dynamic raw) {
|
AnyhowException dco_decode_AnyhowException(dynamic raw) {
|
||||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||||
return AnyhowException(raw as String);
|
return AnyhowException(raw as String);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
RsProcess
|
||||||
|
dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
dynamic raw) {
|
||||||
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||||
|
return RsProcess.dcoDecode(raw as List<dynamic>);
|
||||||
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
RsProcess
|
||||||
|
dco_decode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
dynamic raw) {
|
||||||
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||||
|
return RsProcess.dcoDecode(raw as List<dynamic>);
|
||||||
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
RsProcess
|
||||||
|
dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
dynamic raw) {
|
||||||
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||||
|
return RsProcess.dcoDecode(raw as List<dynamic>);
|
||||||
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
Map<String, String> dco_decode_Map_String_String(dynamic raw) {
|
Map<String, String> dco_decode_Map_String_String(dynamic raw) {
|
||||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||||
@ -246,7 +379,16 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
RustStreamSink<String> dco_decode_StreamSink_String_Dco(dynamic raw) {
|
RsProcess
|
||||||
|
dco_decode_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
dynamic raw) {
|
||||||
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||||
|
return RsProcess.dcoDecode(raw as List<dynamic>);
|
||||||
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
RustStreamSink<RsProcessStreamData>
|
||||||
|
dco_decode_StreamSink_rs_process_stream_data_Dco(dynamic raw) {
|
||||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||||
throw UnimplementedError();
|
throw UnimplementedError();
|
||||||
}
|
}
|
||||||
@ -257,6 +399,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||||||
return raw as String;
|
return raw as String;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int dco_decode_box_autoadd_u_32(dynamic raw) {
|
||||||
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||||
|
return raw as int;
|
||||||
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
int dco_decode_box_autoadd_u_64(dynamic raw) {
|
int dco_decode_box_autoadd_u_64(dynamic raw) {
|
||||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||||
@ -311,6 +459,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||||||
return raw == null ? null : dco_decode_String(raw);
|
return raw == null ? null : dco_decode_String(raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int? dco_decode_opt_box_autoadd_u_32(dynamic raw) {
|
||||||
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||||
|
return raw == null ? null : dco_decode_box_autoadd_u_32(raw);
|
||||||
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
int? dco_decode_opt_box_autoadd_u_64(dynamic raw) {
|
int? dco_decode_opt_box_autoadd_u_64(dynamic raw) {
|
||||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||||
@ -336,6 +490,24 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
RsProcessStreamData dco_decode_rs_process_stream_data(dynamic raw) {
|
||||||
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||||
|
final arr = raw as List<dynamic>;
|
||||||
|
if (arr.length != 2)
|
||||||
|
throw Exception('unexpected arr length: expect 2 but see ${arr.length}');
|
||||||
|
return RsProcessStreamData(
|
||||||
|
dataType: dco_decode_rs_process_stream_data_type(arr[0]),
|
||||||
|
data: dco_decode_String(arr[1]),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
RsProcessStreamDataType dco_decode_rs_process_stream_data_type(dynamic raw) {
|
||||||
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||||
|
return RsProcessStreamDataType.values[raw as int];
|
||||||
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
RustHttpResponse dco_decode_rust_http_response(dynamic raw) {
|
RustHttpResponse dco_decode_rust_http_response(dynamic raw) {
|
||||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||||
@ -359,6 +531,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||||||
return raw as int;
|
return raw as int;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int dco_decode_u_32(dynamic raw) {
|
||||||
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||||
|
return raw as int;
|
||||||
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
int dco_decode_u_64(dynamic raw) {
|
int dco_decode_u_64(dynamic raw) {
|
||||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||||
@ -377,6 +555,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int dco_decode_usize(dynamic raw) {
|
||||||
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||||
|
return dcoDecodeI64OrU64(raw);
|
||||||
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
AnyhowException sse_decode_AnyhowException(SseDeserializer deserializer) {
|
AnyhowException sse_decode_AnyhowException(SseDeserializer deserializer) {
|
||||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
@ -384,6 +568,33 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||||||
return AnyhowException(inner);
|
return AnyhowException(inner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
RsProcess
|
||||||
|
sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
SseDeserializer deserializer) {
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
return RsProcess.sseDecode(
|
||||||
|
sse_decode_usize(deserializer), sse_decode_i_32(deserializer));
|
||||||
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
RsProcess
|
||||||
|
sse_decode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
SseDeserializer deserializer) {
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
return RsProcess.sseDecode(
|
||||||
|
sse_decode_usize(deserializer), sse_decode_i_32(deserializer));
|
||||||
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
RsProcess
|
||||||
|
sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
SseDeserializer deserializer) {
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
return RsProcess.sseDecode(
|
||||||
|
sse_decode_usize(deserializer), sse_decode_i_32(deserializer));
|
||||||
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
Map<String, String> sse_decode_Map_String_String(
|
Map<String, String> sse_decode_Map_String_String(
|
||||||
SseDeserializer deserializer) {
|
SseDeserializer deserializer) {
|
||||||
@ -393,8 +604,18 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
RustStreamSink<String> sse_decode_StreamSink_String_Dco(
|
RsProcess
|
||||||
SseDeserializer deserializer) {
|
sse_decode_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
SseDeserializer deserializer) {
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
return RsProcess.sseDecode(
|
||||||
|
sse_decode_usize(deserializer), sse_decode_i_32(deserializer));
|
||||||
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
RustStreamSink<RsProcessStreamData>
|
||||||
|
sse_decode_StreamSink_rs_process_stream_data_Dco(
|
||||||
|
SseDeserializer deserializer) {
|
||||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
throw UnimplementedError('Unreachable ()');
|
throw UnimplementedError('Unreachable ()');
|
||||||
}
|
}
|
||||||
@ -406,6 +627,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||||||
return utf8.decoder.convert(inner);
|
return utf8.decoder.convert(inner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int sse_decode_box_autoadd_u_32(SseDeserializer deserializer) {
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
return (sse_decode_u_32(deserializer));
|
||||||
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
int sse_decode_box_autoadd_u_64(SseDeserializer deserializer) {
|
int sse_decode_box_autoadd_u_64(SseDeserializer deserializer) {
|
||||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
@ -487,6 +714,17 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int? sse_decode_opt_box_autoadd_u_32(SseDeserializer deserializer) {
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
|
||||||
|
if (sse_decode_bool(deserializer)) {
|
||||||
|
return (sse_decode_box_autoadd_u_32(deserializer));
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
int? sse_decode_opt_box_autoadd_u_64(SseDeserializer deserializer) {
|
int? sse_decode_opt_box_autoadd_u_64(SseDeserializer deserializer) {
|
||||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
@ -518,6 +756,23 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||||||
return (var_field0, var_field1);
|
return (var_field0, var_field1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
RsProcessStreamData sse_decode_rs_process_stream_data(
|
||||||
|
SseDeserializer deserializer) {
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
var var_dataType = sse_decode_rs_process_stream_data_type(deserializer);
|
||||||
|
var var_data = sse_decode_String(deserializer);
|
||||||
|
return RsProcessStreamData(dataType: var_dataType, data: var_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
RsProcessStreamDataType sse_decode_rs_process_stream_data_type(
|
||||||
|
SseDeserializer deserializer) {
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
var inner = sse_decode_i_32(deserializer);
|
||||||
|
return RsProcessStreamDataType.values[inner];
|
||||||
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
RustHttpResponse sse_decode_rust_http_response(SseDeserializer deserializer) {
|
RustHttpResponse sse_decode_rust_http_response(SseDeserializer deserializer) {
|
||||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
@ -544,6 +799,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||||||
return deserializer.buffer.getUint16();
|
return deserializer.buffer.getUint16();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int sse_decode_u_32(SseDeserializer deserializer) {
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
return deserializer.buffer.getUint32();
|
||||||
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
int sse_decode_u_64(SseDeserializer deserializer) {
|
int sse_decode_u_64(SseDeserializer deserializer) {
|
||||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
@ -561,12 +822,50 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
// 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
|
@protected
|
||||||
bool sse_decode_bool(SseDeserializer deserializer) {
|
bool sse_decode_bool(SseDeserializer deserializer) {
|
||||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
return deserializer.buffer.getUint8() != 0;
|
return deserializer.buffer.getUint8() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int cst_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
RsProcess raw) {
|
||||||
|
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||||
|
// ignore: invalid_use_of_internal_member
|
||||||
|
return raw.cstEncode(move: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int cst_encode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
RsProcess raw) {
|
||||||
|
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||||
|
// ignore: invalid_use_of_internal_member
|
||||||
|
return raw.cstEncode(move: false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int cst_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
RsProcess raw) {
|
||||||
|
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||||
|
// ignore: invalid_use_of_internal_member
|
||||||
|
return raw.cstEncode(move: false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int cst_encode_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
RsProcess raw) {
|
||||||
|
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||||
|
// ignore: invalid_use_of_internal_member
|
||||||
|
return raw.cstEncode();
|
||||||
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
int cst_encode_i_32(int raw) {
|
int cst_encode_i_32(int raw) {
|
||||||
// Codec=Cst (C-struct based), see doc to use other codecs
|
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||||
@ -585,12 +884,24 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||||||
return cst_encode_i_32(raw.index);
|
return cst_encode_i_32(raw.index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int cst_encode_rs_process_stream_data_type(RsProcessStreamDataType raw) {
|
||||||
|
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||||
|
return cst_encode_i_32(raw.index);
|
||||||
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
int cst_encode_u_16(int raw) {
|
int cst_encode_u_16(int raw) {
|
||||||
// Codec=Cst (C-struct based), see doc to use other codecs
|
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||||
return raw;
|
return raw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int cst_encode_u_32(int raw) {
|
||||||
|
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||||
|
return raw;
|
||||||
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
int cst_encode_u_8(int raw) {
|
int cst_encode_u_8(int raw) {
|
||||||
// Codec=Cst (C-struct based), see doc to use other codecs
|
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||||
@ -603,6 +914,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||||||
return raw;
|
return raw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int cst_encode_usize(int raw) {
|
||||||
|
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||||
|
return raw;
|
||||||
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
void sse_encode_AnyhowException(
|
void sse_encode_AnyhowException(
|
||||||
AnyhowException self, SseSerializer serializer) {
|
AnyhowException self, SseSerializer serializer) {
|
||||||
@ -610,6 +927,30 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||||||
throw UnimplementedError('Unreachable ()');
|
throw UnimplementedError('Unreachable ()');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
void
|
||||||
|
sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
RsProcess 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_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
RsProcess self, SseSerializer serializer) {
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
sse_encode_usize(self.sseEncode(move: false), serializer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
void
|
||||||
|
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
RsProcess self, SseSerializer serializer) {
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
sse_encode_usize(self.sseEncode(move: false), serializer);
|
||||||
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
void sse_encode_Map_String_String(
|
void sse_encode_Map_String_String(
|
||||||
Map<String, String> self, SseSerializer serializer) {
|
Map<String, String> self, SseSerializer serializer) {
|
||||||
@ -619,13 +960,22 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
void sse_encode_StreamSink_String_Dco(
|
void
|
||||||
RustStreamSink<String> self, SseSerializer serializer) {
|
sse_encode_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
RsProcess 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_StreamSink_rs_process_stream_data_Dco(
|
||||||
|
RustStreamSink<RsProcessStreamData> self, SseSerializer serializer) {
|
||||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
sse_encode_String(
|
sse_encode_String(
|
||||||
self.setupAndSerialize(
|
self.setupAndSerialize(
|
||||||
codec: DcoCodec(
|
codec: DcoCodec(
|
||||||
decodeSuccessData: dco_decode_String, decodeErrorData: null)),
|
decodeSuccessData: dco_decode_rs_process_stream_data,
|
||||||
|
decodeErrorData: null)),
|
||||||
serializer);
|
serializer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -635,6 +985,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||||||
sse_encode_list_prim_u_8_strict(utf8.encoder.convert(self), serializer);
|
sse_encode_list_prim_u_8_strict(utf8.encoder.convert(self), serializer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
void sse_encode_box_autoadd_u_32(int self, SseSerializer serializer) {
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
sse_encode_u_32(self, serializer);
|
||||||
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
void sse_encode_box_autoadd_u_64(int self, SseSerializer serializer) {
|
void sse_encode_box_autoadd_u_64(int self, SseSerializer serializer) {
|
||||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
@ -708,6 +1064,16 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
void sse_encode_opt_box_autoadd_u_32(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_32(self, serializer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
void sse_encode_opt_box_autoadd_u_64(int? self, SseSerializer serializer) {
|
void sse_encode_opt_box_autoadd_u_64(int? self, SseSerializer serializer) {
|
||||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
@ -737,6 +1103,21 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||||||
sse_encode_String(self.$2, serializer);
|
sse_encode_String(self.$2, serializer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
void sse_encode_rs_process_stream_data(
|
||||||
|
RsProcessStreamData self, SseSerializer serializer) {
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
sse_encode_rs_process_stream_data_type(self.dataType, serializer);
|
||||||
|
sse_encode_String(self.data, serializer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
void sse_encode_rs_process_stream_data_type(
|
||||||
|
RsProcessStreamDataType self, SseSerializer serializer) {
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
sse_encode_i_32(self.index, serializer);
|
||||||
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
void sse_encode_rust_http_response(
|
void sse_encode_rust_http_response(
|
||||||
RustHttpResponse self, SseSerializer serializer) {
|
RustHttpResponse self, SseSerializer serializer) {
|
||||||
@ -756,6 +1137,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||||||
serializer.buffer.putUint16(self);
|
serializer.buffer.putUint16(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
void sse_encode_u_32(int self, SseSerializer serializer) {
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
serializer.buffer.putUint32(self);
|
||||||
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
void sse_encode_u_64(int self, SseSerializer serializer) {
|
void sse_encode_u_64(int self, SseSerializer serializer) {
|
||||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
@ -773,6 +1160,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
// 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
|
@protected
|
||||||
void sse_encode_bool(bool self, SseSerializer serializer) {
|
void sse_encode_bool(bool self, SseSerializer serializer) {
|
||||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
// 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
|
// 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/http_api.dart';
|
import 'api/http_api.dart';
|
||||||
import 'api/process_api.dart';
|
import 'api/rs_process.dart';
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:ffi' as ffi;
|
import 'dart:ffi' as ffi;
|
||||||
@ -20,18 +20,45 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||||||
required super.portManager,
|
required super.portManager,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_RsProcessPtr =>
|
||||||
|
wire._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcessPtr;
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
AnyhowException dco_decode_AnyhowException(dynamic raw);
|
AnyhowException dco_decode_AnyhowException(dynamic raw);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
RsProcess
|
||||||
|
dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
dynamic raw);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
RsProcess
|
||||||
|
dco_decode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
dynamic raw);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
RsProcess
|
||||||
|
dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
dynamic raw);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
Map<String, String> dco_decode_Map_String_String(dynamic raw);
|
Map<String, String> dco_decode_Map_String_String(dynamic raw);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
RustStreamSink<String> dco_decode_StreamSink_String_Dco(dynamic raw);
|
RsProcess
|
||||||
|
dco_decode_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
dynamic raw);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
RustStreamSink<RsProcessStreamData>
|
||||||
|
dco_decode_StreamSink_rs_process_stream_data_Dco(dynamic raw);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
String dco_decode_String(dynamic raw);
|
String dco_decode_String(dynamic raw);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int dco_decode_box_autoadd_u_32(dynamic raw);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
int dco_decode_box_autoadd_u_64(dynamic raw);
|
int dco_decode_box_autoadd_u_64(dynamic raw);
|
||||||
|
|
||||||
@ -59,6 +86,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||||||
@protected
|
@protected
|
||||||
String? dco_decode_opt_String(dynamic raw);
|
String? dco_decode_opt_String(dynamic raw);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int? dco_decode_opt_box_autoadd_u_32(dynamic raw);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
int? dco_decode_opt_box_autoadd_u_64(dynamic raw);
|
int? dco_decode_opt_box_autoadd_u_64(dynamic raw);
|
||||||
|
|
||||||
@ -68,12 +98,21 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||||||
@protected
|
@protected
|
||||||
(String, String) dco_decode_record_string_string(dynamic raw);
|
(String, String) dco_decode_record_string_string(dynamic raw);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
RsProcessStreamData dco_decode_rs_process_stream_data(dynamic raw);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
RsProcessStreamDataType dco_decode_rs_process_stream_data_type(dynamic raw);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
RustHttpResponse dco_decode_rust_http_response(dynamic raw);
|
RustHttpResponse dco_decode_rust_http_response(dynamic raw);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
int dco_decode_u_16(dynamic raw);
|
int dco_decode_u_16(dynamic raw);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int dco_decode_u_32(dynamic raw);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
int dco_decode_u_64(dynamic raw);
|
int dco_decode_u_64(dynamic raw);
|
||||||
|
|
||||||
@ -83,20 +122,47 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||||||
@protected
|
@protected
|
||||||
void dco_decode_unit(dynamic raw);
|
void dco_decode_unit(dynamic raw);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int dco_decode_usize(dynamic raw);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
AnyhowException sse_decode_AnyhowException(SseDeserializer deserializer);
|
AnyhowException sse_decode_AnyhowException(SseDeserializer deserializer);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
RsProcess
|
||||||
|
sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
SseDeserializer deserializer);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
RsProcess
|
||||||
|
sse_decode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
SseDeserializer deserializer);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
RsProcess
|
||||||
|
sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
SseDeserializer deserializer);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
Map<String, String> sse_decode_Map_String_String(
|
Map<String, String> sse_decode_Map_String_String(
|
||||||
SseDeserializer deserializer);
|
SseDeserializer deserializer);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
RustStreamSink<String> sse_decode_StreamSink_String_Dco(
|
RsProcess
|
||||||
SseDeserializer deserializer);
|
sse_decode_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
SseDeserializer deserializer);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
RustStreamSink<RsProcessStreamData>
|
||||||
|
sse_decode_StreamSink_rs_process_stream_data_Dco(
|
||||||
|
SseDeserializer deserializer);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
String sse_decode_String(SseDeserializer deserializer);
|
String sse_decode_String(SseDeserializer deserializer);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int sse_decode_box_autoadd_u_32(SseDeserializer deserializer);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
int sse_decode_box_autoadd_u_64(SseDeserializer deserializer);
|
int sse_decode_box_autoadd_u_64(SseDeserializer deserializer);
|
||||||
|
|
||||||
@ -126,6 +192,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||||||
@protected
|
@protected
|
||||||
String? sse_decode_opt_String(SseDeserializer deserializer);
|
String? sse_decode_opt_String(SseDeserializer deserializer);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int? sse_decode_opt_box_autoadd_u_32(SseDeserializer deserializer);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
int? sse_decode_opt_box_autoadd_u_64(SseDeserializer deserializer);
|
int? sse_decode_opt_box_autoadd_u_64(SseDeserializer deserializer);
|
||||||
|
|
||||||
@ -136,12 +205,23 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||||||
(String, String) sse_decode_record_string_string(
|
(String, String) sse_decode_record_string_string(
|
||||||
SseDeserializer deserializer);
|
SseDeserializer deserializer);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
RsProcessStreamData sse_decode_rs_process_stream_data(
|
||||||
|
SseDeserializer deserializer);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
RsProcessStreamDataType sse_decode_rs_process_stream_data_type(
|
||||||
|
SseDeserializer deserializer);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
RustHttpResponse sse_decode_rust_http_response(SseDeserializer deserializer);
|
RustHttpResponse sse_decode_rust_http_response(SseDeserializer deserializer);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
int sse_decode_u_16(SseDeserializer deserializer);
|
int sse_decode_u_16(SseDeserializer deserializer);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int sse_decode_u_32(SseDeserializer deserializer);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
int sse_decode_u_64(SseDeserializer deserializer);
|
int sse_decode_u_64(SseDeserializer deserializer);
|
||||||
|
|
||||||
@ -151,6 +231,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||||||
@protected
|
@protected
|
||||||
void sse_decode_unit(SseDeserializer deserializer);
|
void sse_decode_unit(SseDeserializer deserializer);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int sse_decode_usize(SseDeserializer deserializer);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
bool sse_decode_bool(SseDeserializer deserializer);
|
bool sse_decode_bool(SseDeserializer deserializer);
|
||||||
|
|
||||||
@ -170,12 +253,14 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
ffi.Pointer<wire_cst_list_prim_u_8_strict> cst_encode_StreamSink_String_Dco(
|
ffi.Pointer<wire_cst_list_prim_u_8_strict>
|
||||||
RustStreamSink<String> raw) {
|
cst_encode_StreamSink_rs_process_stream_data_Dco(
|
||||||
|
RustStreamSink<RsProcessStreamData> raw) {
|
||||||
// Codec=Cst (C-struct based), see doc to use other codecs
|
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||||
return cst_encode_String(raw.setupAndSerialize(
|
return cst_encode_String(raw.setupAndSerialize(
|
||||||
codec: DcoCodec(
|
codec: DcoCodec(
|
||||||
decodeSuccessData: dco_decode_String, decodeErrorData: null)));
|
decodeSuccessData: dco_decode_rs_process_stream_data,
|
||||||
|
decodeErrorData: null)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
@ -184,6 +269,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||||||
return cst_encode_list_prim_u_8_strict(utf8.encoder.convert(raw));
|
return cst_encode_list_prim_u_8_strict(utf8.encoder.convert(raw));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
ffi.Pointer<ffi.Uint32> cst_encode_box_autoadd_u_32(int raw) {
|
||||||
|
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||||
|
return wire.cst_new_box_autoadd_u_32(cst_encode_u_32(raw));
|
||||||
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
ffi.Pointer<ffi.Uint64> cst_encode_box_autoadd_u_64(int raw) {
|
ffi.Pointer<ffi.Uint64> cst_encode_box_autoadd_u_64(int raw) {
|
||||||
// Codec=Cst (C-struct based), see doc to use other codecs
|
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||||
@ -234,6 +325,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||||||
return raw == null ? ffi.nullptr : cst_encode_String(raw);
|
return raw == null ? ffi.nullptr : cst_encode_String(raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
ffi.Pointer<ffi.Uint32> cst_encode_opt_box_autoadd_u_32(int? raw) {
|
||||||
|
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||||
|
return raw == null ? ffi.nullptr : cst_encode_box_autoadd_u_32(raw);
|
||||||
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
ffi.Pointer<ffi.Uint64> cst_encode_opt_box_autoadd_u_64(int? raw) {
|
ffi.Pointer<ffi.Uint64> cst_encode_opt_box_autoadd_u_64(int? raw) {
|
||||||
// Codec=Cst (C-struct based), see doc to use other codecs
|
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||||
@ -260,6 +357,13 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||||||
wireObj.field1 = cst_encode_String(apiObj.$2);
|
wireObj.field1 = cst_encode_String(apiObj.$2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
void cst_api_fill_to_wire_rs_process_stream_data(
|
||||||
|
RsProcessStreamData apiObj, wire_cst_rs_process_stream_data wireObj) {
|
||||||
|
wireObj.data_type = cst_encode_rs_process_stream_data_type(apiObj.dataType);
|
||||||
|
wireObj.data = cst_encode_String(apiObj.data);
|
||||||
|
}
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
void cst_api_fill_to_wire_rust_http_response(
|
void cst_api_fill_to_wire_rust_http_response(
|
||||||
RustHttpResponse apiObj, wire_cst_rust_http_response wireObj) {
|
RustHttpResponse apiObj, wire_cst_rust_http_response wireObj) {
|
||||||
@ -273,6 +377,22 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||||||
wireObj.data = cst_encode_opt_list_prim_u_8_strict(apiObj.data);
|
wireObj.data = cst_encode_opt_list_prim_u_8_strict(apiObj.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int cst_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
RsProcess raw);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int cst_encode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
RsProcess raw);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int cst_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
RsProcess raw);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int cst_encode_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
RsProcess raw);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
int cst_encode_i_32(int raw);
|
int cst_encode_i_32(int raw);
|
||||||
|
|
||||||
@ -282,30 +402,62 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||||||
@protected
|
@protected
|
||||||
int cst_encode_my_method(MyMethod raw);
|
int cst_encode_my_method(MyMethod raw);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int cst_encode_rs_process_stream_data_type(RsProcessStreamDataType raw);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
int cst_encode_u_16(int raw);
|
int cst_encode_u_16(int raw);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int cst_encode_u_32(int raw);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
int cst_encode_u_8(int raw);
|
int cst_encode_u_8(int raw);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
void cst_encode_unit(void raw);
|
void cst_encode_unit(void raw);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
int cst_encode_usize(int raw);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
void sse_encode_AnyhowException(
|
void sse_encode_AnyhowException(
|
||||||
AnyhowException self, SseSerializer serializer);
|
AnyhowException self, SseSerializer serializer);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
void
|
||||||
|
sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
RsProcess self, SseSerializer serializer);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
void
|
||||||
|
sse_encode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
RsProcess self, SseSerializer serializer);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
void
|
||||||
|
sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
RsProcess self, SseSerializer serializer);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
void sse_encode_Map_String_String(
|
void sse_encode_Map_String_String(
|
||||||
Map<String, String> self, SseSerializer serializer);
|
Map<String, String> self, SseSerializer serializer);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
void sse_encode_StreamSink_String_Dco(
|
void
|
||||||
RustStreamSink<String> self, SseSerializer serializer);
|
sse_encode_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
RsProcess self, SseSerializer serializer);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
void sse_encode_StreamSink_rs_process_stream_data_Dco(
|
||||||
|
RustStreamSink<RsProcessStreamData> self, SseSerializer serializer);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
void sse_encode_String(String self, SseSerializer serializer);
|
void sse_encode_String(String self, SseSerializer serializer);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
void sse_encode_box_autoadd_u_32(int self, SseSerializer serializer);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
void sse_encode_box_autoadd_u_64(int self, SseSerializer serializer);
|
void sse_encode_box_autoadd_u_64(int self, SseSerializer serializer);
|
||||||
|
|
||||||
@ -336,6 +488,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||||||
@protected
|
@protected
|
||||||
void sse_encode_opt_String(String? self, SseSerializer serializer);
|
void sse_encode_opt_String(String? self, SseSerializer serializer);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
void sse_encode_opt_box_autoadd_u_32(int? self, SseSerializer serializer);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
void sse_encode_opt_box_autoadd_u_64(int? self, SseSerializer serializer);
|
void sse_encode_opt_box_autoadd_u_64(int? self, SseSerializer serializer);
|
||||||
|
|
||||||
@ -347,6 +502,14 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||||||
void sse_encode_record_string_string(
|
void sse_encode_record_string_string(
|
||||||
(String, String) self, SseSerializer serializer);
|
(String, String) self, SseSerializer serializer);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
void sse_encode_rs_process_stream_data(
|
||||||
|
RsProcessStreamData self, SseSerializer serializer);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
void sse_encode_rs_process_stream_data_type(
|
||||||
|
RsProcessStreamDataType self, SseSerializer serializer);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
void sse_encode_rust_http_response(
|
void sse_encode_rust_http_response(
|
||||||
RustHttpResponse self, SseSerializer serializer);
|
RustHttpResponse self, SseSerializer serializer);
|
||||||
@ -354,6 +517,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||||||
@protected
|
@protected
|
||||||
void sse_encode_u_16(int self, SseSerializer serializer);
|
void sse_encode_u_16(int self, SseSerializer serializer);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
void sse_encode_u_32(int self, SseSerializer serializer);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
void sse_encode_u_64(int self, SseSerializer serializer);
|
void sse_encode_u_64(int self, SseSerializer serializer);
|
||||||
|
|
||||||
@ -363,6 +529,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||||||
@protected
|
@protected
|
||||||
void sse_encode_unit(void self, SseSerializer serializer);
|
void sse_encode_unit(void self, SseSerializer serializer);
|
||||||
|
|
||||||
|
@protected
|
||||||
|
void sse_encode_usize(int self, SseSerializer serializer);
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
void sse_encode_bool(bool self, SseSerializer serializer);
|
void sse_encode_bool(bool self, SseSerializer serializer);
|
||||||
}
|
}
|
||||||
@ -499,15 +668,41 @@ class RustLibWire implements BaseWire {
|
|||||||
late final _wire_set_default_header = _wire_set_default_headerPtr.asFunction<
|
late final _wire_set_default_header = _wire_set_default_headerPtr.asFunction<
|
||||||
void Function(int, ffi.Pointer<wire_cst_list_record_string_string>)>();
|
void Function(int, ffi.Pointer<wire_cst_list_record_string_string>)>();
|
||||||
|
|
||||||
void wire_start_process(
|
WireSyncRust2DartDco wire_RsProcess_get_pid(
|
||||||
|
int that,
|
||||||
|
) {
|
||||||
|
return _wire_RsProcess_get_pid(
|
||||||
|
that,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
late final _wire_RsProcess_get_pidPtr =
|
||||||
|
_lookup<ffi.NativeFunction<WireSyncRust2DartDco Function(ffi.UintPtr)>>(
|
||||||
|
'frbgen_starcitizen_doctor_wire_RsProcess_get_pid');
|
||||||
|
late final _wire_RsProcess_get_pid = _wire_RsProcess_get_pidPtr
|
||||||
|
.asFunction<WireSyncRust2DartDco Function(int)>();
|
||||||
|
|
||||||
|
WireSyncRust2DartDco wire_RsProcess_new() {
|
||||||
|
return _wire_RsProcess_new();
|
||||||
|
}
|
||||||
|
|
||||||
|
late final _wire_RsProcess_newPtr =
|
||||||
|
_lookup<ffi.NativeFunction<WireSyncRust2DartDco Function()>>(
|
||||||
|
'frbgen_starcitizen_doctor_wire_RsProcess_new');
|
||||||
|
late final _wire_RsProcess_new =
|
||||||
|
_wire_RsProcess_newPtr.asFunction<WireSyncRust2DartDco Function()>();
|
||||||
|
|
||||||
|
void wire_RsProcess_start(
|
||||||
int port_,
|
int port_,
|
||||||
|
int that,
|
||||||
ffi.Pointer<wire_cst_list_prim_u_8_strict> executable,
|
ffi.Pointer<wire_cst_list_prim_u_8_strict> executable,
|
||||||
ffi.Pointer<wire_cst_list_String> arguments,
|
ffi.Pointer<wire_cst_list_String> arguments,
|
||||||
ffi.Pointer<wire_cst_list_prim_u_8_strict> working_directory,
|
ffi.Pointer<wire_cst_list_prim_u_8_strict> working_directory,
|
||||||
ffi.Pointer<wire_cst_list_prim_u_8_strict> stream_sink,
|
ffi.Pointer<wire_cst_list_prim_u_8_strict> stream_sink,
|
||||||
) {
|
) {
|
||||||
return _wire_start_process(
|
return _wire_RsProcess_start(
|
||||||
port_,
|
port_,
|
||||||
|
that,
|
||||||
executable,
|
executable,
|
||||||
arguments,
|
arguments,
|
||||||
working_directory,
|
working_directory,
|
||||||
@ -515,23 +710,91 @@ class RustLibWire implements BaseWire {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
late final _wire_start_processPtr = _lookup<
|
late final _wire_RsProcess_startPtr = _lookup<
|
||||||
ffi.NativeFunction<
|
ffi.NativeFunction<
|
||||||
ffi.Void Function(
|
ffi.Void Function(
|
||||||
ffi.Int64,
|
ffi.Int64,
|
||||||
|
ffi.UintPtr,
|
||||||
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
|
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
|
||||||
ffi.Pointer<wire_cst_list_String>,
|
ffi.Pointer<wire_cst_list_String>,
|
||||||
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
|
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
|
||||||
ffi.Pointer<wire_cst_list_prim_u_8_strict>)>>(
|
ffi.Pointer<wire_cst_list_prim_u_8_strict>)>>(
|
||||||
'frbgen_starcitizen_doctor_wire_start_process');
|
'frbgen_starcitizen_doctor_wire_RsProcess_start');
|
||||||
late final _wire_start_process = _wire_start_processPtr.asFunction<
|
late final _wire_RsProcess_start = _wire_RsProcess_startPtr.asFunction<
|
||||||
void Function(
|
void Function(
|
||||||
|
int,
|
||||||
int,
|
int,
|
||||||
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
|
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
|
||||||
ffi.Pointer<wire_cst_list_String>,
|
ffi.Pointer<wire_cst_list_String>,
|
||||||
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
|
ffi.Pointer<wire_cst_list_prim_u_8_strict>,
|
||||||
ffi.Pointer<wire_cst_list_prim_u_8_strict>)>();
|
ffi.Pointer<wire_cst_list_prim_u_8_strict>)>();
|
||||||
|
|
||||||
|
void wire_RsProcess_write(
|
||||||
|
int port_,
|
||||||
|
int that,
|
||||||
|
ffi.Pointer<wire_cst_list_prim_u_8_strict> data,
|
||||||
|
) {
|
||||||
|
return _wire_RsProcess_write(
|
||||||
|
port_,
|
||||||
|
that,
|
||||||
|
data,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
late final _wire_RsProcess_writePtr = _lookup<
|
||||||
|
ffi.NativeFunction<
|
||||||
|
ffi.Void Function(ffi.Int64, ffi.UintPtr,
|
||||||
|
ffi.Pointer<wire_cst_list_prim_u_8_strict>)>>(
|
||||||
|
'frbgen_starcitizen_doctor_wire_RsProcess_write');
|
||||||
|
late final _wire_RsProcess_write = _wire_RsProcess_writePtr.asFunction<
|
||||||
|
void Function(int, int, ffi.Pointer<wire_cst_list_prim_u_8_strict>)>();
|
||||||
|
|
||||||
|
void
|
||||||
|
rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
ffi.Pointer<ffi.Void> ptr,
|
||||||
|
) {
|
||||||
|
return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
ptr,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcessPtr =
|
||||||
|
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>)>>(
|
||||||
|
'frbgen_starcitizen_doctor_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess');
|
||||||
|
late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess =
|
||||||
|
_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcessPtr
|
||||||
|
.asFunction<void Function(ffi.Pointer<ffi.Void>)>();
|
||||||
|
|
||||||
|
void
|
||||||
|
rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
ffi.Pointer<ffi.Void> ptr,
|
||||||
|
) {
|
||||||
|
return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
ptr,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcessPtr =
|
||||||
|
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>)>>(
|
||||||
|
'frbgen_starcitizen_doctor_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess');
|
||||||
|
late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess =
|
||||||
|
_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcessPtr
|
||||||
|
.asFunction<void Function(ffi.Pointer<ffi.Void>)>();
|
||||||
|
|
||||||
|
ffi.Pointer<ffi.Uint32> cst_new_box_autoadd_u_32(
|
||||||
|
int value,
|
||||||
|
) {
|
||||||
|
return _cst_new_box_autoadd_u_32(
|
||||||
|
value,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
late final _cst_new_box_autoadd_u_32Ptr =
|
||||||
|
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Uint32> Function(ffi.Uint32)>>(
|
||||||
|
'frbgen_starcitizen_doctor_cst_new_box_autoadd_u_32');
|
||||||
|
late final _cst_new_box_autoadd_u_32 = _cst_new_box_autoadd_u_32Ptr
|
||||||
|
.asFunction<ffi.Pointer<ffi.Uint32> Function(int)>();
|
||||||
|
|
||||||
ffi.Pointer<ffi.Uint64> cst_new_box_autoadd_u_64(
|
ffi.Pointer<ffi.Uint64> cst_new_box_autoadd_u_64(
|
||||||
int value,
|
int value,
|
||||||
) {
|
) {
|
||||||
@ -641,6 +904,13 @@ final class wire_cst_list_String extends ffi.Struct {
|
|||||||
external int len;
|
external int len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final class wire_cst_rs_process_stream_data extends ffi.Struct {
|
||||||
|
@ffi.Int32()
|
||||||
|
external int data_type;
|
||||||
|
|
||||||
|
external ffi.Pointer<wire_cst_list_prim_u_8_strict> data;
|
||||||
|
}
|
||||||
|
|
||||||
final class wire_cst_rust_http_response extends ffi.Struct {
|
final class wire_cst_rust_http_response extends ffi.Struct {
|
||||||
@ffi.Uint16()
|
@ffi.Uint16()
|
||||||
external int status_code;
|
external int status_code;
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
import 'package:starcitizen_doctor/common/conf/binary_conf.dart';
|
import 'package:starcitizen_doctor/common/conf/binary_conf.dart';
|
||||||
import 'package:starcitizen_doctor/common/rust/api/process_api.dart'
|
|
||||||
as rs_process;
|
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
import 'package:aria2/aria2.dart';
|
import 'package:aria2/aria2.dart';
|
||||||
@ -10,6 +8,7 @@ import 'package:flutter/foundation.dart';
|
|||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:starcitizen_doctor/api/api.dart';
|
import 'package:starcitizen_doctor/api/api.dart';
|
||||||
import 'package:starcitizen_doctor/common/helper/system_helper.dart';
|
import 'package:starcitizen_doctor/common/helper/system_helper.dart';
|
||||||
|
import 'package:starcitizen_doctor/common/rust/api/rs_process.dart';
|
||||||
|
|
||||||
import 'package:starcitizen_doctor/common/utils/log.dart';
|
import 'package:starcitizen_doctor/common/utils/log.dart';
|
||||||
import 'package:starcitizen_doctor/common/utils/provider.dart';
|
import 'package:starcitizen_doctor/common/utils/provider.dart';
|
||||||
@ -98,7 +97,9 @@ class Aria2cModel extends _$Aria2cModel {
|
|||||||
dPrint("trackerList === $trackerList");
|
dPrint("trackerList === $trackerList");
|
||||||
dPrint("Aria2cManager .----- aria2c start $port------");
|
dPrint("Aria2cManager .----- aria2c start $port------");
|
||||||
|
|
||||||
final stream = rs_process.startProcess(
|
final rsp = RsProcess();
|
||||||
|
|
||||||
|
final stream = rsp.start(
|
||||||
executable: exePath,
|
executable: exePath,
|
||||||
arguments: [
|
arguments: [
|
||||||
"-V",
|
"-V",
|
||||||
@ -122,16 +123,20 @@ class Aria2cModel extends _$Aria2cModel {
|
|||||||
|
|
||||||
stream.listen((event) {
|
stream.listen((event) {
|
||||||
dPrint("Aria2cManager.rs_process event === $event");
|
dPrint("Aria2cManager.rs_process event === $event");
|
||||||
if (event.startsWith("output:")) {
|
switch (event.dataType) {
|
||||||
if (event.contains("IPv4 RPC: listening on TCP port")) {
|
case RsProcessStreamDataType.output:
|
||||||
_onLaunch(port, pwd, trackerList);
|
if (event.data.contains("IPv4 RPC: listening on TCP port")) {
|
||||||
}
|
_onLaunch(port, pwd, trackerList);
|
||||||
} else if (event.startsWith("error:")) {
|
}
|
||||||
state = state.copyWith(aria2c: null);
|
break;
|
||||||
launchError = event;
|
case RsProcessStreamDataType.error:
|
||||||
} else if (event.startsWith("exit:")) {
|
launchError = event.data;
|
||||||
state = state.copyWith(aria2c: null);
|
state = state.copyWith(aria2c: null);
|
||||||
launchError = event;
|
break;
|
||||||
|
case RsProcessStreamDataType.exit:
|
||||||
|
launchError = event.data;
|
||||||
|
state = state.copyWith(aria2c: null);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import 'package:flutter/foundation.dart';
|
|||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
import 'package:starcitizen_doctor/common/conf/binary_conf.dart';
|
import 'package:starcitizen_doctor/common/conf/binary_conf.dart';
|
||||||
|
import 'package:starcitizen_doctor/common/rust/api/rs_process.dart';
|
||||||
import 'package:starcitizen_doctor/common/utils/log.dart';
|
import 'package:starcitizen_doctor/common/utils/log.dart';
|
||||||
import 'package:starcitizen_doctor/common/utils/provider.dart';
|
import 'package:starcitizen_doctor/common/utils/provider.dart';
|
||||||
import 'package:starcitizen_doctor/data/app_unp4k_p4k_item_data.dart';
|
import 'package:starcitizen_doctor/data/app_unp4k_p4k_item_data.dart';
|
||||||
@ -29,7 +30,7 @@ class Unp4kcState with _$Unp4kcState {
|
|||||||
|
|
||||||
@riverpod
|
@riverpod
|
||||||
class Unp4kCModel extends _$Unp4kCModel {
|
class Unp4kCModel extends _$Unp4kCModel {
|
||||||
Process? _process;
|
RsProcess? _process;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Unp4kcState build() {
|
Unp4kcState build() {
|
||||||
@ -48,41 +49,50 @@ class Unp4kCModel extends _$Unp4kCModel {
|
|||||||
await BinaryModuleConf.extractModule(
|
await BinaryModuleConf.extractModule(
|
||||||
["unp4kc"], appGlobalState.applicationBinaryModuleDir!);
|
["unp4kc"], appGlobalState.applicationBinaryModuleDir!);
|
||||||
final exec = "$execDir\\unp4kc.exe";
|
final exec = "$execDir\\unp4kc.exe";
|
||||||
final ps = await Process.start(exec, []);
|
// final ps = await Process.start(exec, []);
|
||||||
StringBuffer stringBuffer = StringBuffer();
|
// StringBuffer stringBuffer = StringBuffer();
|
||||||
_process = ps;
|
|
||||||
ps.stdout.listen((event) async {
|
_process = RsProcess();
|
||||||
final eventStr = String.fromCharCodes(event);
|
|
||||||
stringBuffer.write(eventStr);
|
final stream = _process?.start(
|
||||||
if (!eventStr.endsWith("\n")) return;
|
executable: exec, arguments: [], workingDirectory: execDir);
|
||||||
final str = stringBuffer.toString().trim();
|
|
||||||
stringBuffer.clear();
|
stream?.listen((event) async {
|
||||||
try {
|
switch (event.dataType) {
|
||||||
final eventJson = await compute(json.decode, str);
|
case RsProcessStreamDataType.output:
|
||||||
_handleMessage(eventJson, ps);
|
try {
|
||||||
} catch (e) {
|
final eventJson = await compute(json.decode, event.data);
|
||||||
dPrint("[unp4kc] json error: $e");
|
_handleMessage(eventJson);
|
||||||
|
} catch (e) {
|
||||||
|
dPrint("[unp4kc] json error: $e");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RsProcessStreamDataType.error:
|
||||||
|
dPrint("[unp4kc] stderr: ${event.data}");
|
||||||
|
break;
|
||||||
|
case RsProcessStreamDataType.exit:
|
||||||
|
dPrint("[unp4kc] exit: ${event.data}");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ps.stderr.listen((event) {
|
|
||||||
final eventStr = String.fromCharCodes(event);
|
|
||||||
dPrint("[unp4kc] stderr: $eventStr");
|
|
||||||
});
|
|
||||||
state = state.copyWith(startUp: true);
|
|
||||||
ref.onDispose(() {
|
ref.onDispose(() {
|
||||||
ps.kill();
|
final pid = _process?.getPid();
|
||||||
dPrint("[unp4kc] kill ...");
|
if (pid != null) {
|
||||||
|
Process.killPid(pid);
|
||||||
|
dPrint("[unp4kc] kill ...");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _handleMessage(Map<String, dynamic> eventJson, Process ps) async {
|
void _handleMessage(Map<String, dynamic> eventJson) async {
|
||||||
final action = eventJson["action"];
|
final action = eventJson["action"];
|
||||||
final data = eventJson["data"];
|
final data = eventJson["data"];
|
||||||
final gamePath = getGamePath();
|
final gamePath = getGamePath();
|
||||||
final gameP4kPath = "$gamePath\\Data.p4k";
|
final gameP4kPath = "$gamePath\\Data.p4k";
|
||||||
switch (action.toString().trim()) {
|
switch (action.toString().trim()) {
|
||||||
case "info: startup":
|
case "info: startup":
|
||||||
ps.stdin.writeln(gameP4kPath);
|
_process?.write(data: "$gameP4kPath\n");
|
||||||
state = state.copyWith(endMessage: "正在读取P4K 文件 ...");
|
state = state.copyWith(endMessage: "正在读取P4K 文件 ...");
|
||||||
break;
|
break;
|
||||||
case "data: P4K_Files":
|
case "data: P4K_Files":
|
||||||
@ -117,7 +127,6 @@ class Unp4kCModel extends _$Unp4kCModel {
|
|||||||
openType = "image";
|
openType = "image";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
state = state.copyWith(
|
state = state.copyWith(
|
||||||
tempOpenFile: MapEntry(openType, filePath),
|
tempOpenFile: MapEntry(openType, filePath),
|
||||||
endMessage: "打开文件:$filePath");
|
endMessage: "打开文件:$filePath");
|
||||||
@ -186,6 +195,6 @@ class Unp4kCModel extends _$Unp4kCModel {
|
|||||||
}
|
}
|
||||||
outputPath = "$outputPath$filePath";
|
outputPath = "$outputPath$filePath";
|
||||||
dPrint("extractFile .... $filePath");
|
dPrint("extractFile .... $filePath");
|
||||||
_process?.stdin.writeln("$mode<:,:>$filePath<:,:>$outputPath");
|
_process?.write(data: "$mode<:,:>$filePath<:,:>$outputPath");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ strip = "debuginfo"
|
|||||||
crate-type = ["cdylib", "staticlib"]
|
crate-type = ["cdylib", "staticlib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
flutter_rust_bridge = "=2.0.0-dev.32"
|
flutter_rust_bridge = { version = "=2.0.0-dev.32" }
|
||||||
tokio = { version = "1", features = ["rt", "rt-multi-thread", "macros", "process"] }
|
tokio = { version = "1", features = ["rt", "rt-multi-thread", "macros", "process"] }
|
||||||
url = "2.5"
|
url = "2.5"
|
||||||
async-std = "1.12"
|
async-std = "1.12"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use std::collections::HashMap;
|
|
||||||
use reqwest::Method;
|
|
||||||
use crate::http_package;
|
use crate::http_package;
|
||||||
use crate::http_package::RustHttpResponse;
|
use crate::http_package::RustHttpResponse;
|
||||||
|
use reqwest::Method;
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
pub enum MyMethod {
|
pub enum MyMethod {
|
||||||
Options,
|
Options,
|
||||||
@ -17,15 +17,15 @@ pub enum MyMethod {
|
|||||||
|
|
||||||
fn _my_method_to_hyper_method(m: MyMethod) -> Method {
|
fn _my_method_to_hyper_method(m: MyMethod) -> Method {
|
||||||
return match m {
|
return match m {
|
||||||
MyMethod::Options => { Method::OPTIONS }
|
MyMethod::Options => Method::OPTIONS,
|
||||||
MyMethod::Gets => { Method::GET }
|
MyMethod::Gets => Method::GET,
|
||||||
MyMethod::Post => { Method::POST }
|
MyMethod::Post => Method::POST,
|
||||||
MyMethod::Put => { Method::PUT }
|
MyMethod::Put => Method::PUT,
|
||||||
MyMethod::Delete => { Method::DELETE }
|
MyMethod::Delete => Method::DELETE,
|
||||||
MyMethod::Head => { Method::HEAD }
|
MyMethod::Head => Method::HEAD,
|
||||||
MyMethod::Trace => { Method::TRACE }
|
MyMethod::Trace => Method::TRACE,
|
||||||
MyMethod::Connect => { Method::CONNECT }
|
MyMethod::Connect => Method::CONNECT,
|
||||||
MyMethod::Patch => { Method::PATCH }
|
MyMethod::Patch => Method::PATCH,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,11 +33,21 @@ pub fn set_default_header(headers: HashMap<String, String>) {
|
|||||||
http_package::set_default_header(headers)
|
http_package::set_default_header(headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn fetch(method: MyMethod,
|
pub async fn fetch(
|
||||||
url: String,
|
method: MyMethod,
|
||||||
headers: Option<HashMap<String, String>>,
|
url: String,
|
||||||
input_data: Option<Vec<u8>>, with_ip_address: Option<String>) -> anyhow::Result<RustHttpResponse> {
|
headers: Option<HashMap<String, String>>,
|
||||||
http_package::fetch(_my_method_to_hyper_method(method), url, headers, input_data, with_ip_address).await
|
input_data: Option<Vec<u8>>,
|
||||||
|
with_ip_address: Option<String>,
|
||||||
|
) -> anyhow::Result<RustHttpResponse> {
|
||||||
|
http_package::fetch(
|
||||||
|
_my_method_to_hyper_method(method),
|
||||||
|
url,
|
||||||
|
headers,
|
||||||
|
input_data,
|
||||||
|
with_ip_address,
|
||||||
|
)
|
||||||
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn dns_lookup_txt(host: String) -> anyhow::Result<Vec<String>> {
|
pub async fn dns_lookup_txt(host: String) -> anyhow::Result<Vec<String>> {
|
||||||
@ -46,4 +56,4 @@ pub async fn dns_lookup_txt(host: String) -> anyhow::Result<Vec<String>> {
|
|||||||
|
|
||||||
pub async fn dns_lookup_ips(host: String) -> anyhow::Result<Vec<String>> {
|
pub async fn dns_lookup_ips(host: String) -> anyhow::Result<Vec<String>> {
|
||||||
http_package::dns_lookup_ips(host).await
|
http_package::dns_lookup_ips(host).await
|
||||||
}
|
}
|
||||||
|
@ -3,4 +3,4 @@
|
|||||||
//
|
//
|
||||||
pub mod http_api;
|
pub mod http_api;
|
||||||
|
|
||||||
pub mod process_api;
|
pub mod rs_process;
|
||||||
|
@ -1,90 +0,0 @@
|
|||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
use tokio::io::{AsyncBufReadExt, BufReader};
|
|
||||||
|
|
||||||
use crate::frb_generated::StreamSink;
|
|
||||||
|
|
||||||
pub async fn start_process(
|
|
||||||
executable: String,
|
|
||||||
arguments: Vec<String>,
|
|
||||||
working_directory: String,
|
|
||||||
stream_sink: StreamSink<String>,
|
|
||||||
) {
|
|
||||||
let stream_sink_arc = Arc::from(stream_sink);
|
|
||||||
|
|
||||||
let mut command = tokio::process::Command::new(&executable);
|
|
||||||
command
|
|
||||||
.args(arguments)
|
|
||||||
.current_dir(working_directory)
|
|
||||||
.stdout(std::process::Stdio::piped())
|
|
||||||
.stderr(std::process::Stdio::piped())
|
|
||||||
.kill_on_drop(true);
|
|
||||||
|
|
||||||
command.creation_flags(0x08000000);
|
|
||||||
|
|
||||||
let job = win32job::Job::create().unwrap();
|
|
||||||
let mut info = job.query_extended_limit_info().unwrap();
|
|
||||||
info.limit_kill_on_job_close();
|
|
||||||
job.set_extended_limit_info(&mut info).unwrap();
|
|
||||||
|
|
||||||
let job_arc = Arc::from(job);
|
|
||||||
|
|
||||||
if let Ok(mut child) = command.spawn() {
|
|
||||||
{
|
|
||||||
let raw_handle = child.raw_handle();
|
|
||||||
if raw_handle.is_some() {
|
|
||||||
job_arc.assign_process(raw_handle.unwrap() as isize).unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let stdout = child.stdout.take().expect("Failed to open stdout");
|
|
||||||
let stderr = child.stderr.take().expect("Failed to open stderr");
|
|
||||||
// let stdin = child.stdin.take().expect("Failed to open stderr");
|
|
||||||
|
|
||||||
let output_task = tokio::spawn(process_output(stdout, stream_sink_arc.clone()));
|
|
||||||
let error_task = tokio::spawn(process_error(stderr, stream_sink_arc.clone()));
|
|
||||||
// let input_task = tokio::spawn(process_input(stdin));
|
|
||||||
|
|
||||||
tokio::select! {
|
|
||||||
_ = output_task => (),
|
|
||||||
_ = error_task => (),
|
|
||||||
// _ = input_task => (),
|
|
||||||
}
|
|
||||||
|
|
||||||
let exit_status = child.wait().await.expect("Failed to wait for child process");
|
|
||||||
if !exit_status.success() {
|
|
||||||
eprintln!("Child process exited with an error: {:?}", exit_status);
|
|
||||||
stream_sink_arc.add("exit:".to_string()).unwrap();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
eprintln!("Failed to start {}", executable);
|
|
||||||
stream_sink_arc.add("error:Failed to start".to_string()).unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn process_output<R>(stdout: R, stream_sink: Arc<StreamSink<String>>)
|
|
||||||
where
|
|
||||||
R: tokio::io::AsyncRead + Unpin,
|
|
||||||
{
|
|
||||||
let reader = BufReader::new(stdout);
|
|
||||||
let mut lines = reader.lines();
|
|
||||||
|
|
||||||
while let Some(line) = lines.next_line().await.unwrap() {
|
|
||||||
if line.trim().is_empty() {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
println!("{}", line.trim());
|
|
||||||
stream_sink.add("output:".to_string() + &*line.trim().to_string()).unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn process_error<R>(stderr: R, stream_sink: Arc<StreamSink<String>>)
|
|
||||||
where
|
|
||||||
R: tokio::io::AsyncRead + Unpin,
|
|
||||||
{
|
|
||||||
let reader = BufReader::new(stderr);
|
|
||||||
let mut lines = reader.lines();
|
|
||||||
while let Some(line) = lines.next_line().await.unwrap() {
|
|
||||||
println!("{}", line.trim());
|
|
||||||
stream_sink.add("error:".to_string() + &*line.trim().to_string()).unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
152
rust/src/api/rs_process.rs
Normal file
152
rust/src/api/rs_process.rs
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
use flutter_rust_bridge::for_generated::futures::lock::Mutex;
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use flutter_rust_bridge::frb;
|
||||||
|
use tokio::io::BufReader;
|
||||||
|
use tokio::io::{AsyncBufReadExt, AsyncWriteExt};
|
||||||
|
use tokio::process::ChildStdin;
|
||||||
|
|
||||||
|
use crate::frb_generated::StreamSink;
|
||||||
|
|
||||||
|
#[frb(opaque)]
|
||||||
|
pub struct RsProcess {
|
||||||
|
child_stdin: Option<Arc<Mutex<ChildStdin>>>,
|
||||||
|
pid: Option<u32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy)]
|
||||||
|
pub enum RsProcessStreamDataType {
|
||||||
|
Output,
|
||||||
|
Error,
|
||||||
|
Exit,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct RsProcessStreamData {
|
||||||
|
pub data_type: RsProcessStreamDataType,
|
||||||
|
pub data: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl RsProcess {
|
||||||
|
#[frb(sync)]
|
||||||
|
pub fn new() -> Self {
|
||||||
|
RsProcess {
|
||||||
|
child_stdin: None,
|
||||||
|
pid: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn start(
|
||||||
|
&mut self,
|
||||||
|
executable: String,
|
||||||
|
arguments: Vec<String>,
|
||||||
|
working_directory: String,
|
||||||
|
stream_sink: StreamSink<RsProcessStreamData>,
|
||||||
|
) {
|
||||||
|
let stream_sink_arc = Arc::from(stream_sink);
|
||||||
|
|
||||||
|
let mut command = tokio::process::Command::new(executable);
|
||||||
|
command
|
||||||
|
.args(arguments)
|
||||||
|
.current_dir(working_directory)
|
||||||
|
.stdin(std::process::Stdio::piped())
|
||||||
|
.stdout(std::process::Stdio::piped())
|
||||||
|
.stderr(std::process::Stdio::piped())
|
||||||
|
.kill_on_drop(true);
|
||||||
|
|
||||||
|
command.creation_flags(0x08000000);
|
||||||
|
|
||||||
|
let job = win32job::Job::create().unwrap();
|
||||||
|
let mut info = job.query_extended_limit_info().unwrap();
|
||||||
|
info.limit_kill_on_job_close();
|
||||||
|
job.set_extended_limit_info(&mut info).unwrap();
|
||||||
|
|
||||||
|
let job_arc = Arc::from(job);
|
||||||
|
|
||||||
|
if let Ok(mut child) = command.spawn() {
|
||||||
|
{
|
||||||
|
let raw_handle = child.raw_handle();
|
||||||
|
if raw_handle.is_some() {
|
||||||
|
job_arc
|
||||||
|
.assign_process(raw_handle.unwrap() as isize)
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let stdout = child.stdout.take().expect("Failed to open stdout");
|
||||||
|
let stderr = child.stderr.take().expect("Failed to open stderr");
|
||||||
|
|
||||||
|
let stdin = child.stdin.take().expect("Failed to open stdin");
|
||||||
|
self.child_stdin = Some(Arc::from(Mutex::new(stdin)));
|
||||||
|
|
||||||
|
let output_task = tokio::spawn(_process_output(
|
||||||
|
stdout,
|
||||||
|
stream_sink_arc.clone(),
|
||||||
|
RsProcessStreamDataType::Output,
|
||||||
|
));
|
||||||
|
let error_task = tokio::spawn(_process_output(
|
||||||
|
stderr,
|
||||||
|
stream_sink_arc.clone(),
|
||||||
|
RsProcessStreamDataType::Error,
|
||||||
|
));
|
||||||
|
|
||||||
|
self.pid = child.id();
|
||||||
|
|
||||||
|
tokio::select! {
|
||||||
|
_ = output_task => (),
|
||||||
|
_ = error_task => (),
|
||||||
|
}
|
||||||
|
|
||||||
|
let exit_status = child
|
||||||
|
.wait()
|
||||||
|
.await
|
||||||
|
.expect("Failed to wait for child process");
|
||||||
|
|
||||||
|
if !exit_status.success() {
|
||||||
|
eprintln!("Child process exited with an error: {:?}", exit_status);
|
||||||
|
let message = RsProcessStreamData {
|
||||||
|
data_type: RsProcessStreamDataType::Exit,
|
||||||
|
data: "exit".to_string(),
|
||||||
|
};
|
||||||
|
stream_sink_arc.add(message).unwrap();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
eprintln!("Failed to start");
|
||||||
|
let message = RsProcessStreamData {
|
||||||
|
data_type: RsProcessStreamDataType::Error,
|
||||||
|
data: "Failed to start".to_string(),
|
||||||
|
};
|
||||||
|
stream_sink_arc.add(message).unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn write(&mut self, data: String) {
|
||||||
|
if let Some(stdin) = &self.child_stdin {
|
||||||
|
let mut stdin_lock = stdin.lock().await;
|
||||||
|
stdin_lock.write_all(data.as_bytes()).await.unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[frb(sync)]
|
||||||
|
pub fn get_pid(&self) -> Option<u32> {
|
||||||
|
self.pid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn _process_output<R>(
|
||||||
|
stdout: R,
|
||||||
|
stream_sink: Arc<StreamSink<RsProcessStreamData>>,
|
||||||
|
data_type: RsProcessStreamDataType,
|
||||||
|
) where
|
||||||
|
R: tokio::io::AsyncRead + Unpin,
|
||||||
|
{
|
||||||
|
let reader = BufReader::new(stdout);
|
||||||
|
let mut lines = reader.lines();
|
||||||
|
|
||||||
|
while let Some(line) = lines.next_line().await.unwrap() {
|
||||||
|
let message = RsProcessStreamData {
|
||||||
|
data_type,
|
||||||
|
data: line.trim().parse().unwrap(),
|
||||||
|
};
|
||||||
|
stream_sink.add(message).unwrap();
|
||||||
|
}
|
||||||
|
}
|
@ -4,6 +4,7 @@
|
|||||||
// Section: imports
|
// Section: imports
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use crate::api::rs_process::*;
|
||||||
use flutter_rust_bridge::for_generated::byteorder::{NativeEndian, ReadBytesExt, WriteBytesExt};
|
use flutter_rust_bridge::for_generated::byteorder::{NativeEndian, ReadBytesExt, WriteBytesExt};
|
||||||
use flutter_rust_bridge::for_generated::transform_result_dco;
|
use flutter_rust_bridge::for_generated::transform_result_dco;
|
||||||
use flutter_rust_bridge::{Handler, IntoIntoDart};
|
use flutter_rust_bridge::{Handler, IntoIntoDart};
|
||||||
@ -22,6 +23,12 @@ impl CstDecode<flutter_rust_bridge::for_generated::anyhow::Error>
|
|||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
impl CstDecode<RsProcess> for usize {
|
||||||
|
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||||
|
fn cst_decode(self) -> RsProcess {
|
||||||
|
CstDecode::<RustOpaqueNom<flutter_rust_bridge::for_generated::rust_async::RwLock<RsProcess>>>::cst_decode(self).rust_auto_opaque_decode_owned()
|
||||||
|
}
|
||||||
|
}
|
||||||
impl CstDecode<std::collections::HashMap<String, String>>
|
impl CstDecode<std::collections::HashMap<String, String>>
|
||||||
for *mut wire_cst_list_record_string_string
|
for *mut wire_cst_list_record_string_string
|
||||||
{
|
{
|
||||||
@ -31,11 +38,31 @@ impl CstDecode<std::collections::HashMap<String, String>>
|
|||||||
vec.into_iter().collect()
|
vec.into_iter().collect()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl CstDecode<StreamSink<String, flutter_rust_bridge::for_generated::DcoCodec>>
|
impl CstDecode<RustOpaqueNom<flutter_rust_bridge::for_generated::rust_async::RwLock<RsProcess>>>
|
||||||
for *mut wire_cst_list_prim_u_8_strict
|
for usize
|
||||||
{
|
{
|
||||||
// Codec=Cst (C-struct based), see doc to use other codecs
|
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||||
fn cst_decode(self) -> StreamSink<String, flutter_rust_bridge::for_generated::DcoCodec> {
|
fn cst_decode(
|
||||||
|
self,
|
||||||
|
) -> RustOpaqueNom<flutter_rust_bridge::for_generated::rust_async::RwLock<RsProcess>> {
|
||||||
|
unsafe { decode_rust_opaque_nom(self as _) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl
|
||||||
|
CstDecode<
|
||||||
|
StreamSink<
|
||||||
|
crate::api::rs_process::RsProcessStreamData,
|
||||||
|
flutter_rust_bridge::for_generated::DcoCodec,
|
||||||
|
>,
|
||||||
|
> for *mut wire_cst_list_prim_u_8_strict
|
||||||
|
{
|
||||||
|
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||||
|
fn cst_decode(
|
||||||
|
self,
|
||||||
|
) -> StreamSink<
|
||||||
|
crate::api::rs_process::RsProcessStreamData,
|
||||||
|
flutter_rust_bridge::for_generated::DcoCodec,
|
||||||
|
> {
|
||||||
let raw: String = self.cst_decode();
|
let raw: String = self.cst_decode();
|
||||||
StreamSink::deserialize(raw)
|
StreamSink::deserialize(raw)
|
||||||
}
|
}
|
||||||
@ -47,6 +74,12 @@ impl CstDecode<String> for *mut wire_cst_list_prim_u_8_strict {
|
|||||||
String::from_utf8(vec).unwrap()
|
String::from_utf8(vec).unwrap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
impl CstDecode<u32> for *mut u32 {
|
||||||
|
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||||
|
fn cst_decode(self) -> u32 {
|
||||||
|
unsafe { *flutter_rust_bridge::for_generated::box_from_leak_ptr(self) }
|
||||||
|
}
|
||||||
|
}
|
||||||
impl CstDecode<u64> for *mut u64 {
|
impl CstDecode<u64> for *mut u64 {
|
||||||
// Codec=Cst (C-struct based), see doc to use other codecs
|
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||||
fn cst_decode(self) -> u64 {
|
fn cst_decode(self) -> u64 {
|
||||||
@ -88,6 +121,15 @@ impl CstDecode<(String, String)> for wire_cst_record_string_string {
|
|||||||
(self.field0.cst_decode(), self.field1.cst_decode())
|
(self.field0.cst_decode(), self.field1.cst_decode())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
impl CstDecode<crate::api::rs_process::RsProcessStreamData> for wire_cst_rs_process_stream_data {
|
||||||
|
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||||
|
fn cst_decode(self) -> crate::api::rs_process::RsProcessStreamData {
|
||||||
|
crate::api::rs_process::RsProcessStreamData {
|
||||||
|
data_type: self.data_type.cst_decode(),
|
||||||
|
data: self.data.cst_decode(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
impl CstDecode<crate::http_package::RustHttpResponse> for wire_cst_rust_http_response {
|
impl CstDecode<crate::http_package::RustHttpResponse> for wire_cst_rust_http_response {
|
||||||
// Codec=Cst (C-struct based), see doc to use other codecs
|
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||||
fn cst_decode(self) -> crate::http_package::RustHttpResponse {
|
fn cst_decode(self) -> crate::http_package::RustHttpResponse {
|
||||||
@ -115,6 +157,19 @@ impl Default for wire_cst_record_string_string {
|
|||||||
Self::new_with_null_ptr()
|
Self::new_with_null_ptr()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
impl NewWithNullPtr for wire_cst_rs_process_stream_data {
|
||||||
|
fn new_with_null_ptr() -> Self {
|
||||||
|
Self {
|
||||||
|
data_type: Default::default(),
|
||||||
|
data: core::ptr::null_mut(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Default for wire_cst_rs_process_stream_data {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new_with_null_ptr()
|
||||||
|
}
|
||||||
|
}
|
||||||
impl NewWithNullPtr for wire_cst_rust_http_response {
|
impl NewWithNullPtr for wire_cst_rust_http_response {
|
||||||
fn new_with_null_ptr() -> Self {
|
fn new_with_null_ptr() -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -171,14 +226,67 @@ pub extern "C" fn frbgen_starcitizen_doctor_wire_set_default_header(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn frbgen_starcitizen_doctor_wire_start_process(
|
pub extern "C" fn frbgen_starcitizen_doctor_wire_RsProcess_get_pid(
|
||||||
|
that: usize,
|
||||||
|
) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco {
|
||||||
|
wire_RsProcess_get_pid_impl(that)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn frbgen_starcitizen_doctor_wire_RsProcess_new(
|
||||||
|
) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco {
|
||||||
|
wire_RsProcess_new_impl()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn frbgen_starcitizen_doctor_wire_RsProcess_start(
|
||||||
port_: i64,
|
port_: i64,
|
||||||
|
that: usize,
|
||||||
executable: *mut wire_cst_list_prim_u_8_strict,
|
executable: *mut wire_cst_list_prim_u_8_strict,
|
||||||
arguments: *mut wire_cst_list_String,
|
arguments: *mut wire_cst_list_String,
|
||||||
working_directory: *mut wire_cst_list_prim_u_8_strict,
|
working_directory: *mut wire_cst_list_prim_u_8_strict,
|
||||||
stream_sink: *mut wire_cst_list_prim_u_8_strict,
|
stream_sink: *mut wire_cst_list_prim_u_8_strict,
|
||||||
) {
|
) {
|
||||||
wire_start_process_impl(port_, executable, arguments, working_directory, stream_sink)
|
wire_RsProcess_start_impl(
|
||||||
|
port_,
|
||||||
|
that,
|
||||||
|
executable,
|
||||||
|
arguments,
|
||||||
|
working_directory,
|
||||||
|
stream_sink,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn frbgen_starcitizen_doctor_wire_RsProcess_write(
|
||||||
|
port_: i64,
|
||||||
|
that: usize,
|
||||||
|
data: *mut wire_cst_list_prim_u_8_strict,
|
||||||
|
) {
|
||||||
|
wire_RsProcess_write_impl(port_, that, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn frbgen_starcitizen_doctor_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
ptr: *const std::ffi::c_void,
|
||||||
|
) {
|
||||||
|
unsafe {
|
||||||
|
StdArc::<flutter_rust_bridge::for_generated::rust_async::RwLock<RsProcess>>::increment_strong_count(ptr as _);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn frbgen_starcitizen_doctor_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockRsProcess(
|
||||||
|
ptr: *const std::ffi::c_void,
|
||||||
|
) {
|
||||||
|
unsafe {
|
||||||
|
StdArc::<flutter_rust_bridge::for_generated::rust_async::RwLock<RsProcess>>::decrement_strong_count(ptr as _);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn frbgen_starcitizen_doctor_cst_new_box_autoadd_u_32(value: u32) -> *mut u32 {
|
||||||
|
flutter_rust_bridge::for_generated::new_leak_box_ptr(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
@ -251,6 +359,12 @@ pub struct wire_cst_record_string_string {
|
|||||||
}
|
}
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
|
pub struct wire_cst_rs_process_stream_data {
|
||||||
|
data_type: i32,
|
||||||
|
data: *mut wire_cst_list_prim_u_8_strict,
|
||||||
|
}
|
||||||
|
#[repr(C)]
|
||||||
|
#[derive(Clone, Copy)]
|
||||||
pub struct wire_cst_rust_http_response {
|
pub struct wire_cst_rust_http_response {
|
||||||
status_code: u16,
|
status_code: u16,
|
||||||
headers: *mut wire_cst_list_record_string_string,
|
headers: *mut wire_cst_list_record_string_string,
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
// Section: imports
|
// Section: imports
|
||||||
|
|
||||||
|
use crate::api::rs_process::*;
|
||||||
use flutter_rust_bridge::for_generated::byteorder::{NativeEndian, ReadBytesExt, WriteBytesExt};
|
use flutter_rust_bridge::for_generated::byteorder::{NativeEndian, ReadBytesExt, WriteBytesExt};
|
||||||
use flutter_rust_bridge::for_generated::transform_result_dco;
|
use flutter_rust_bridge::for_generated::transform_result_dco;
|
||||||
use flutter_rust_bridge::{Handler, IntoIntoDart};
|
use flutter_rust_bridge::{Handler, IntoIntoDart};
|
||||||
@ -31,7 +32,7 @@ flutter_rust_bridge::frb_generated_boilerplate!(
|
|||||||
default_rust_auto_opaque = RustAutoOpaqueNom,
|
default_rust_auto_opaque = RustAutoOpaqueNom,
|
||||||
);
|
);
|
||||||
pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_VERSION: &str = "2.0.0-dev.32";
|
pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_VERSION: &str = "2.0.0-dev.32";
|
||||||
pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = 593879172;
|
pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = 333909092;
|
||||||
|
|
||||||
// Section: executor
|
// Section: executor
|
||||||
|
|
||||||
@ -139,20 +140,63 @@ fn wire_set_default_header_impl(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
fn wire_start_process_impl(
|
fn wire_RsProcess_get_pid_impl(
|
||||||
|
that: impl CstDecode<
|
||||||
|
RustOpaqueNom<flutter_rust_bridge::for_generated::rust_async::RwLock<RsProcess>>,
|
||||||
|
>,
|
||||||
|
) -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco {
|
||||||
|
FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::<flutter_rust_bridge::for_generated::DcoCodec, _>(
|
||||||
|
flutter_rust_bridge::for_generated::TaskInfo {
|
||||||
|
debug_name: "RsProcess_get_pid",
|
||||||
|
port: None,
|
||||||
|
mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync,
|
||||||
|
},
|
||||||
|
move || {
|
||||||
|
let api_that = that.cst_decode();
|
||||||
|
transform_result_dco((move || {
|
||||||
|
let api_that = api_that.rust_auto_opaque_decode_ref();
|
||||||
|
Result::<_, ()>::Ok(crate::api::rs_process::RsProcess::get_pid(&api_that))
|
||||||
|
})())
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
fn wire_RsProcess_new_impl() -> flutter_rust_bridge::for_generated::WireSyncRust2DartDco {
|
||||||
|
FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::<flutter_rust_bridge::for_generated::DcoCodec, _>(
|
||||||
|
flutter_rust_bridge::for_generated::TaskInfo {
|
||||||
|
debug_name: "RsProcess_new",
|
||||||
|
port: None,
|
||||||
|
mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync,
|
||||||
|
},
|
||||||
|
move || {
|
||||||
|
transform_result_dco((move || {
|
||||||
|
Result::<_, ()>::Ok(crate::api::rs_process::RsProcess::new())
|
||||||
|
})())
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
fn wire_RsProcess_start_impl(
|
||||||
port_: flutter_rust_bridge::for_generated::MessagePort,
|
port_: flutter_rust_bridge::for_generated::MessagePort,
|
||||||
|
that: impl CstDecode<
|
||||||
|
RustOpaqueNom<flutter_rust_bridge::for_generated::rust_async::RwLock<RsProcess>>,
|
||||||
|
>,
|
||||||
executable: impl CstDecode<String>,
|
executable: impl CstDecode<String>,
|
||||||
arguments: impl CstDecode<Vec<String>>,
|
arguments: impl CstDecode<Vec<String>>,
|
||||||
working_directory: impl CstDecode<String>,
|
working_directory: impl CstDecode<String>,
|
||||||
stream_sink: impl CstDecode<StreamSink<String, flutter_rust_bridge::for_generated::DcoCodec>>,
|
stream_sink: impl CstDecode<
|
||||||
|
StreamSink<
|
||||||
|
crate::api::rs_process::RsProcessStreamData,
|
||||||
|
flutter_rust_bridge::for_generated::DcoCodec,
|
||||||
|
>,
|
||||||
|
>,
|
||||||
) {
|
) {
|
||||||
FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::<flutter_rust_bridge::for_generated::DcoCodec, _, _, _>(
|
FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::<flutter_rust_bridge::for_generated::DcoCodec, _, _, _>(
|
||||||
flutter_rust_bridge::for_generated::TaskInfo {
|
flutter_rust_bridge::for_generated::TaskInfo {
|
||||||
debug_name: "start_process",
|
debug_name: "RsProcess_start",
|
||||||
port: Some(port_),
|
port: Some(port_),
|
||||||
mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal,
|
mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal,
|
||||||
},
|
},
|
||||||
move || {
|
move || {
|
||||||
|
let api_that = that.cst_decode();
|
||||||
let api_executable = executable.cst_decode();
|
let api_executable = executable.cst_decode();
|
||||||
let api_arguments = arguments.cst_decode();
|
let api_arguments = arguments.cst_decode();
|
||||||
let api_working_directory = working_directory.cst_decode();
|
let api_working_directory = working_directory.cst_decode();
|
||||||
@ -160,8 +204,10 @@ fn wire_start_process_impl(
|
|||||||
move |context| async move {
|
move |context| async move {
|
||||||
transform_result_dco(
|
transform_result_dco(
|
||||||
(move || async move {
|
(move || async move {
|
||||||
|
let mut api_that = api_that.rust_auto_opaque_decode_ref_mut();
|
||||||
Result::<_, ()>::Ok(
|
Result::<_, ()>::Ok(
|
||||||
crate::api::process_api::start_process(
|
crate::api::rs_process::RsProcess::start(
|
||||||
|
&mut api_that,
|
||||||
api_executable,
|
api_executable,
|
||||||
api_arguments,
|
api_arguments,
|
||||||
api_working_directory,
|
api_working_directory,
|
||||||
@ -176,6 +222,36 @@ fn wire_start_process_impl(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
fn wire_RsProcess_write_impl(
|
||||||
|
port_: flutter_rust_bridge::for_generated::MessagePort,
|
||||||
|
that: impl CstDecode<
|
||||||
|
RustOpaqueNom<flutter_rust_bridge::for_generated::rust_async::RwLock<RsProcess>>,
|
||||||
|
>,
|
||||||
|
data: impl CstDecode<String>,
|
||||||
|
) {
|
||||||
|
FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::<flutter_rust_bridge::for_generated::DcoCodec, _, _, _>(
|
||||||
|
flutter_rust_bridge::for_generated::TaskInfo {
|
||||||
|
debug_name: "RsProcess_write",
|
||||||
|
port: Some(port_),
|
||||||
|
mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal,
|
||||||
|
},
|
||||||
|
move || {
|
||||||
|
let api_that = that.cst_decode();
|
||||||
|
let api_data = data.cst_decode();
|
||||||
|
move |context| async move {
|
||||||
|
transform_result_dco(
|
||||||
|
(move || async move {
|
||||||
|
let mut api_that = api_that.rust_auto_opaque_decode_ref_mut();
|
||||||
|
Result::<_, ()>::Ok(
|
||||||
|
crate::api::rs_process::RsProcess::write(&mut api_that, api_data).await,
|
||||||
|
)
|
||||||
|
})()
|
||||||
|
.await,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// Section: dart2rust
|
// Section: dart2rust
|
||||||
|
|
||||||
@ -216,12 +292,29 @@ impl CstDecode<crate::api::http_api::MyMethod> for i32 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
impl CstDecode<crate::api::rs_process::RsProcessStreamDataType> for i32 {
|
||||||
|
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||||
|
fn cst_decode(self) -> crate::api::rs_process::RsProcessStreamDataType {
|
||||||
|
match self {
|
||||||
|
0 => crate::api::rs_process::RsProcessStreamDataType::Output,
|
||||||
|
1 => crate::api::rs_process::RsProcessStreamDataType::Error,
|
||||||
|
2 => crate::api::rs_process::RsProcessStreamDataType::Exit,
|
||||||
|
_ => unreachable!("Invalid variant for RsProcessStreamDataType: {}", self),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
impl CstDecode<u16> for u16 {
|
impl CstDecode<u16> for u16 {
|
||||||
// Codec=Cst (C-struct based), see doc to use other codecs
|
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||||
fn cst_decode(self) -> u16 {
|
fn cst_decode(self) -> u16 {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
impl CstDecode<u32> for u32 {
|
||||||
|
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||||
|
fn cst_decode(self) -> u32 {
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
impl CstDecode<u64> for u64 {
|
impl CstDecode<u64> for u64 {
|
||||||
// Codec=Cst (C-struct based), see doc to use other codecs
|
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||||
fn cst_decode(self) -> u64 {
|
fn cst_decode(self) -> u64 {
|
||||||
@ -234,6 +327,12 @@ impl CstDecode<u8> for u8 {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
impl CstDecode<usize> for usize {
|
||||||
|
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||||
|
fn cst_decode(self) -> usize {
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
impl SseDecode for flutter_rust_bridge::for_generated::anyhow::Error {
|
impl SseDecode for flutter_rust_bridge::for_generated::anyhow::Error {
|
||||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||||
@ -241,6 +340,16 @@ impl SseDecode for flutter_rust_bridge::for_generated::anyhow::Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl SseDecode for RsProcess {
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||||
|
let mut inner = <RustOpaqueNom<
|
||||||
|
flutter_rust_bridge::for_generated::rust_async::RwLock<RsProcess>,
|
||||||
|
>>::sse_decode(deserializer);
|
||||||
|
return inner.rust_auto_opaque_decode_owned();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl SseDecode for std::collections::HashMap<String, String> {
|
impl SseDecode for std::collections::HashMap<String, String> {
|
||||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||||
@ -249,7 +358,22 @@ impl SseDecode for std::collections::HashMap<String, String> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SseDecode for StreamSink<String, flutter_rust_bridge::for_generated::DcoCodec> {
|
impl SseDecode
|
||||||
|
for RustOpaqueNom<flutter_rust_bridge::for_generated::rust_async::RwLock<RsProcess>>
|
||||||
|
{
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||||
|
let mut inner = <usize>::sse_decode(deserializer);
|
||||||
|
return unsafe { decode_rust_opaque_nom(inner) };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SseDecode
|
||||||
|
for StreamSink<
|
||||||
|
crate::api::rs_process::RsProcessStreamData,
|
||||||
|
flutter_rust_bridge::for_generated::DcoCodec,
|
||||||
|
>
|
||||||
|
{
|
||||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||||
let mut inner = <String>::sse_decode(deserializer);
|
let mut inner = <String>::sse_decode(deserializer);
|
||||||
@ -367,6 +491,17 @@ impl SseDecode for Option<String> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl SseDecode for Option<u32> {
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||||
|
if (<bool>::sse_decode(deserializer)) {
|
||||||
|
return Some(<u32>::sse_decode(deserializer));
|
||||||
|
} else {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl SseDecode for Option<u64> {
|
impl SseDecode for Option<u64> {
|
||||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||||
@ -398,6 +533,32 @@ impl SseDecode for (String, String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl SseDecode for crate::api::rs_process::RsProcessStreamData {
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||||
|
let mut var_dataType =
|
||||||
|
<crate::api::rs_process::RsProcessStreamDataType>::sse_decode(deserializer);
|
||||||
|
let mut var_data = <String>::sse_decode(deserializer);
|
||||||
|
return crate::api::rs_process::RsProcessStreamData {
|
||||||
|
data_type: var_dataType,
|
||||||
|
data: var_data,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SseDecode for crate::api::rs_process::RsProcessStreamDataType {
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||||
|
let mut inner = <i32>::sse_decode(deserializer);
|
||||||
|
return match inner {
|
||||||
|
0 => crate::api::rs_process::RsProcessStreamDataType::Output,
|
||||||
|
1 => crate::api::rs_process::RsProcessStreamDataType::Error,
|
||||||
|
2 => crate::api::rs_process::RsProcessStreamDataType::Exit,
|
||||||
|
_ => unreachable!("Invalid variant for RsProcessStreamDataType: {}", inner),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl SseDecode for crate::http_package::RustHttpResponse {
|
impl SseDecode for crate::http_package::RustHttpResponse {
|
||||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||||
@ -427,6 +588,13 @@ impl SseDecode for u16 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl SseDecode for u32 {
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||||
|
deserializer.cursor.read_u32::<NativeEndian>().unwrap()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl SseDecode for u64 {
|
impl SseDecode for u64 {
|
||||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||||
@ -446,6 +614,13 @@ impl SseDecode for () {
|
|||||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {}
|
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl SseDecode for usize {
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||||
|
deserializer.cursor.read_u64::<NativeEndian>().unwrap() as _
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl SseDecode for bool {
|
impl SseDecode for bool {
|
||||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||||
@ -480,6 +655,21 @@ fn pde_ffi_dispatcher_sync_impl(
|
|||||||
|
|
||||||
// Section: rust2dart
|
// Section: rust2dart
|
||||||
|
|
||||||
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||||
|
impl flutter_rust_bridge::IntoDart for FrbWrapper<RsProcess> {
|
||||||
|
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
|
||||||
|
flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, StdArc<_>>(self.0)
|
||||||
|
.into_dart()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive for FrbWrapper<RsProcess> {}
|
||||||
|
|
||||||
|
impl flutter_rust_bridge::IntoIntoDart<FrbWrapper<RsProcess>> for RsProcess {
|
||||||
|
fn into_into_dart(self) -> FrbWrapper<RsProcess> {
|
||||||
|
self.into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||||
impl flutter_rust_bridge::IntoDart for crate::http_package::MyHttpVersion {
|
impl flutter_rust_bridge::IntoDart for crate::http_package::MyHttpVersion {
|
||||||
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
|
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
|
||||||
@ -532,6 +722,48 @@ impl flutter_rust_bridge::IntoIntoDart<crate::api::http_api::MyMethod>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||||
|
impl flutter_rust_bridge::IntoDart for crate::api::rs_process::RsProcessStreamData {
|
||||||
|
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
|
||||||
|
[
|
||||||
|
self.data_type.into_into_dart().into_dart(),
|
||||||
|
self.data.into_into_dart().into_dart(),
|
||||||
|
]
|
||||||
|
.into_dart()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive
|
||||||
|
for crate::api::rs_process::RsProcessStreamData
|
||||||
|
{
|
||||||
|
}
|
||||||
|
impl flutter_rust_bridge::IntoIntoDart<crate::api::rs_process::RsProcessStreamData>
|
||||||
|
for crate::api::rs_process::RsProcessStreamData
|
||||||
|
{
|
||||||
|
fn into_into_dart(self) -> crate::api::rs_process::RsProcessStreamData {
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||||
|
impl flutter_rust_bridge::IntoDart for crate::api::rs_process::RsProcessStreamDataType {
|
||||||
|
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
|
||||||
|
match self {
|
||||||
|
Self::Output => 0.into_dart(),
|
||||||
|
Self::Error => 1.into_dart(),
|
||||||
|
Self::Exit => 2.into_dart(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive
|
||||||
|
for crate::api::rs_process::RsProcessStreamDataType
|
||||||
|
{
|
||||||
|
}
|
||||||
|
impl flutter_rust_bridge::IntoIntoDart<crate::api::rs_process::RsProcessStreamDataType>
|
||||||
|
for crate::api::rs_process::RsProcessStreamDataType
|
||||||
|
{
|
||||||
|
fn into_into_dart(self) -> crate::api::rs_process::RsProcessStreamDataType {
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||||
impl flutter_rust_bridge::IntoDart for crate::http_package::RustHttpResponse {
|
impl flutter_rust_bridge::IntoDart for crate::http_package::RustHttpResponse {
|
||||||
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
|
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
|
||||||
[
|
[
|
||||||
@ -565,6 +797,13 @@ impl SseEncode for flutter_rust_bridge::for_generated::anyhow::Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl SseEncode for RsProcess {
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||||
|
<RustOpaqueNom<flutter_rust_bridge::for_generated::rust_async::RwLock<RsProcess>>>::sse_encode(flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, StdArc<_>>(self), serializer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl SseEncode for std::collections::HashMap<String, String> {
|
impl SseEncode for std::collections::HashMap<String, String> {
|
||||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||||
@ -572,7 +811,23 @@ impl SseEncode for std::collections::HashMap<String, String> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SseEncode for StreamSink<String, flutter_rust_bridge::for_generated::DcoCodec> {
|
impl SseEncode
|
||||||
|
for RustOpaqueNom<flutter_rust_bridge::for_generated::rust_async::RwLock<RsProcess>>
|
||||||
|
{
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||||
|
let (ptr, size) = self.sse_encode_raw();
|
||||||
|
<usize>::sse_encode(ptr, serializer);
|
||||||
|
<i32>::sse_encode(size, serializer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SseEncode
|
||||||
|
for StreamSink<
|
||||||
|
crate::api::rs_process::RsProcessStreamData,
|
||||||
|
flutter_rust_bridge::for_generated::DcoCodec,
|
||||||
|
>
|
||||||
|
{
|
||||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||||
unimplemented!("")
|
unimplemented!("")
|
||||||
@ -686,6 +941,16 @@ impl SseEncode for Option<String> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl SseEncode for Option<u32> {
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||||
|
<bool>::sse_encode(self.is_some(), serializer);
|
||||||
|
if let Some(value) = self {
|
||||||
|
<u32>::sse_encode(value, serializer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl SseEncode for Option<u64> {
|
impl SseEncode for Option<u64> {
|
||||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||||
@ -714,6 +979,31 @@ impl SseEncode for (String, String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl SseEncode for crate::api::rs_process::RsProcessStreamData {
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||||
|
<crate::api::rs_process::RsProcessStreamDataType>::sse_encode(self.data_type, serializer);
|
||||||
|
<String>::sse_encode(self.data, serializer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SseEncode for crate::api::rs_process::RsProcessStreamDataType {
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||||
|
<i32>::sse_encode(
|
||||||
|
match self {
|
||||||
|
crate::api::rs_process::RsProcessStreamDataType::Output => 0,
|
||||||
|
crate::api::rs_process::RsProcessStreamDataType::Error => 1,
|
||||||
|
crate::api::rs_process::RsProcessStreamDataType::Exit => 2,
|
||||||
|
_ => {
|
||||||
|
unimplemented!("");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
serializer,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl SseEncode for crate::http_package::RustHttpResponse {
|
impl SseEncode for crate::http_package::RustHttpResponse {
|
||||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||||
@ -734,6 +1024,13 @@ impl SseEncode for u16 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl SseEncode for u32 {
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||||
|
serializer.cursor.write_u32::<NativeEndian>(self).unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl SseEncode for u64 {
|
impl SseEncode for u64 {
|
||||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||||
@ -753,6 +1050,16 @@ impl SseEncode for () {
|
|||||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {}
|
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl SseEncode for usize {
|
||||||
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
|
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||||
|
serializer
|
||||||
|
.cursor
|
||||||
|
.write_u64::<NativeEndian>(self as _)
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl SseEncode for bool {
|
impl SseEncode for bool {
|
||||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
use hickory_resolver::config::{NameServerConfigGroup, ResolverConfig, ResolverOpts};
|
use hickory_resolver::config::{NameServerConfigGroup, ResolverConfig, ResolverOpts};
|
||||||
use hickory_resolver::{lookup_ip::LookupIpIntoIter, TokioAsyncResolver};
|
use hickory_resolver::{lookup_ip::LookupIpIntoIter, TokioAsyncResolver};
|
||||||
|
use lazy_static::lazy_static;
|
||||||
use once_cell::sync::OnceCell;
|
use once_cell::sync::OnceCell;
|
||||||
use reqwest::dns::{Addrs, Name, Resolve, Resolving};
|
use reqwest::dns::{Addrs, Name, Resolve, Resolving};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
use lazy_static::lazy_static;
|
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
pub static ref MY_HOSTS_MAP: RwLock<HashMap<String, IpAddr>> = RwLock::from(HashMap::new());
|
pub static ref MY_HOSTS_MAP: RwLock<HashMap<String, IpAddr>> = RwLock::from(HashMap::new());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Wrapper around an `AsyncResolver`, which implements the `Resolve` trait.
|
/// Wrapper around an `AsyncResolver`, which implements the `Resolve` trait.
|
||||||
@ -60,10 +60,7 @@ impl MyHickoryDnsResolver {
|
|||||||
pub(crate) async fn lookup_ips(&self, name: String) -> anyhow::Result<Vec<String>> {
|
pub(crate) async fn lookup_ips(&self, name: String) -> anyhow::Result<Vec<String>> {
|
||||||
let resolver = self.state.get_or_try_init(new_resolver)?;
|
let resolver = self.state.get_or_try_init(new_resolver)?;
|
||||||
let ips = resolver.ipv4_lookup(name).await?;
|
let ips = resolver.ipv4_lookup(name).await?;
|
||||||
let t = ips
|
let t = ips.iter().map(|ip| ip.to_string()).collect::<Vec<_>>();
|
||||||
.iter()
|
|
||||||
.map(|ip| ip.to_string())
|
|
||||||
.collect::<Vec<_>>();
|
|
||||||
Ok(t)
|
Ok(t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,7 +85,9 @@ fn new_resolver() -> io::Result<TokioAsyncResolver> {
|
|||||||
IpAddr::V4(Ipv4Addr::new(166, 111, 8, 28)),
|
IpAddr::V4(Ipv4Addr::new(166, 111, 8, 28)),
|
||||||
IpAddr::V4(Ipv4Addr::new(101, 226, 4, 6)),
|
IpAddr::V4(Ipv4Addr::new(101, 226, 4, 6)),
|
||||||
IpAddr::V4(Ipv4Addr::new(114, 114, 114, 114)),
|
IpAddr::V4(Ipv4Addr::new(114, 114, 114, 114)),
|
||||||
], 53, false,
|
],
|
||||||
|
53,
|
||||||
|
false,
|
||||||
);
|
);
|
||||||
let cfg = ResolverConfig::from_parts(None, vec![], group);
|
let cfg = ResolverConfig::from_parts(None, vec![], group);
|
||||||
let mut opts = ResolverOpts::default();
|
let mut opts = ResolverOpts::default();
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
pub mod dns;
|
pub mod dns;
|
||||||
|
|
||||||
use scopeguard::defer;
|
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use reqwest::header::{HeaderMap, HeaderName, HeaderValue};
|
use reqwest::header::{HeaderMap, HeaderName, HeaderValue};
|
||||||
use reqwest::{Method, RequestBuilder};
|
use reqwest::{Method, RequestBuilder};
|
||||||
|
use scopeguard::defer;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
@ -45,7 +45,8 @@ fn _hyper_version_to_my_version(v: reqwest::Version) -> MyHttpVersion {
|
|||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref DEFAULT_HEADER: RwLock<HeaderMap> = RwLock::from(HeaderMap::new());
|
static ref DEFAULT_HEADER: RwLock<HeaderMap> = RwLock::from(HeaderMap::new());
|
||||||
static ref DNS_CLIENT: Arc<dns::MyHickoryDnsResolver> = Arc::from(dns::MyHickoryDnsResolver::default());
|
static ref DNS_CLIENT: Arc<dns::MyHickoryDnsResolver> =
|
||||||
|
Arc::from(dns::MyHickoryDnsResolver::default());
|
||||||
static ref HTTP_CLIENT: reqwest::Client = new_http_client(true);
|
static ref HTTP_CLIENT: reqwest::Client = new_http_client(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +89,11 @@ pub async fn fetch(
|
|||||||
if address_clone.is_some() {
|
if address_clone.is_some() {
|
||||||
let addr = std::net::IpAddr::from_str(with_ip_address.unwrap().as_str()).unwrap();
|
let addr = std::net::IpAddr::from_str(with_ip_address.unwrap().as_str()).unwrap();
|
||||||
let mut hosts = dns::MY_HOSTS_MAP.write().unwrap();
|
let mut hosts = dns::MY_HOSTS_MAP.write().unwrap();
|
||||||
let url_host = Url::from_str(url.as_str()).unwrap().host().unwrap().to_string();
|
let url_host = Url::from_str(url.as_str())
|
||||||
|
.unwrap()
|
||||||
|
.host()
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
hosts.insert(url_host, addr);
|
hosts.insert(url_host, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
mod frb_generated;
|
|
||||||
pub mod api;
|
pub mod api;
|
||||||
|
mod frb_generated;
|
||||||
pub mod http_package;
|
pub mod http_package;
|
||||||
|
Loading…
Reference in New Issue
Block a user