app/lib/common/rust/api/rs_process.dart

54 lines
1.6 KiB
Dart
Raw Normal View History

2024-04-16 22:34:50 +08:00
// This file is automatically generated, so please do not edit it.
2024-06-17 19:16:09 +08:00
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.40.
2024-04-16 22:34:50 +08:00
// 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';
2024-06-11 19:55:35 +08:00
// These functions are ignored because they are not marked as `pub`: `_process_output`
// These types are ignored because they are not used by any `pub` functions: `RsProcess`
2024-04-17 21:40:08 +08:00
Stream<RsProcessStreamData> start(
{required String executable,
required List<String> arguments,
2024-06-04 20:29:31 +08:00
required String workingDirectory}) =>
2024-05-22 20:05:50 +08:00
RustLib.instance.api.crateApiRsProcessStart(
2024-04-17 21:40:08 +08:00
executable: executable,
arguments: arguments,
2024-06-04 20:29:31 +08:00
workingDirectory: workingDirectory);
2024-04-17 21:40:08 +08:00
2024-06-04 20:29:31 +08:00
Future<void> write({required int rsPid, required String data}) =>
RustLib.instance.api.crateApiRsProcessWrite(rsPid: rsPid, data: data);
2024-04-16 22:34:50 +08:00
class RsProcessStreamData {
final RsProcessStreamDataType dataType;
final String data;
2024-04-17 21:40:08 +08:00
final int rsPid;
2024-04-16 22:34:50 +08:00
const RsProcessStreamData({
required this.dataType,
required this.data,
2024-04-17 21:40:08 +08:00
required this.rsPid,
2024-04-16 22:34:50 +08:00
});
@override
2024-04-17 21:40:08 +08:00
int get hashCode => dataType.hashCode ^ data.hashCode ^ rsPid.hashCode;
2024-04-16 22:34:50 +08:00
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is RsProcessStreamData &&
runtimeType == other.runtimeType &&
dataType == other.dataType &&
2024-04-17 21:40:08 +08:00
data == other.data &&
rsPid == other.rsPid;
2024-04-16 22:34:50 +08:00
}
enum RsProcessStreamDataType {
output,
error,
exit,
;
}