mirror of
https://ghfast.top/https://github.com/StarCitizenToolBox/app.git
synced 2025-08-03 05:21:40 +08:00
引入 Rust \\TODO 使用 rust 实现的下载器
This commit is contained in:
23
lib/common/rust/ffi.dart
Normal file
23
lib/common/rust/ffi.dart
Normal file
@ -0,0 +1,23 @@
|
||||
// This file initializes the dynamic library and connects it with the stub
|
||||
// generated by flutter_rust_bridge_codegen.
|
||||
|
||||
import 'dart:ffi';
|
||||
|
||||
import 'bridge_generated.dart';
|
||||
import 'bridge_definitions.dart';
|
||||
export 'bridge_definitions.dart';
|
||||
|
||||
// Re-export the bridge so it is only necessary to import this file.
|
||||
export 'bridge_generated.dart';
|
||||
import 'dart:io' as io;
|
||||
|
||||
|
||||
const _base = 'rust';
|
||||
|
||||
// On MacOS, the dynamic library is not bundled with the binary,
|
||||
// but rather directly **linked** against the binary.
|
||||
final _dylib = io.Platform.isWindows ? '$_base.dll' : 'lib$_base.so';
|
||||
|
||||
final Rust rustFii = RustImpl(io.Platform.isIOS || io.Platform.isMacOS
|
||||
? DynamicLibrary.executable()
|
||||
: DynamicLibrary.open(_dylib));
|
Reference in New Issue
Block a user