v1.1.1
native_toolchain_rust
Dart 빌드 훅을 위한 Rust 지원. Rust 코드를 Dart 코드와 함께 자동으로 빌드하고 번들링합니다!
29좋아요 8.4만30일 다운로드160Pub 점수
AndroidiOSLinuxmacOSWindows
Dart의 네이티브 자산을 위한 루스트 지원
아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
native_toolchain_rust 🦀Rust support for Dart's build hooks.
assetName,
and the rest is auto-magically figured out.
(But you can still tweak the functionality as much as you need to!)flutter pub add native_toolchain_rust hooks for Flutter or dart pub add native_toolchain_rust hooks for Dart-onlynative_toolchain_rust will look (by default) for native/ or rust/ (customizable)
in your Dart package's root.
If you haven't already, create a Cargo.toml and rust-toolchain.toml in your chosen Rust directory;
keep reading for what these two files must contain
(but don't worry if you forget, you'll get a helpful error message).
hook/build.dartimport 'package:hooks/hooks.dart';
import 'package:native_toolchain_rust/native_toolchain_rust.dart';
void main(List<String> args) async {
await build(args, (input, output) async {
await RustBuilder(
assetName: 'src/my_ffi_bindings.g.dart',
// ...maybe enable some Cargo features or something in here too
).run(input: input, output: output);
});
}
Cargo.tomlKeep at least the following in your Cargo.toml.
[package]
name = "my-crate-name" # pick a name, doesn't matter
[lib]
crate-type = ["staticlib", "cdylib"] # THESE ARE IMPORTANT!
rust-toolchain.tomlKeep at least the following in your rust-toolchain.toml.
[toolchain]
# WARNING: *do not* use `stable`, `beta`, or `nightly` (alone) for the channel!
# You must specify a version number/date in order to ensure reproducible builds.
channel = "1.90.0" # or newer. another example: `nightly-2025-01-01`
# The targets you want to support; these are the default:
targets = [
# Android
"armv7-linux-androideabi",
"aarch64-linux-android",
"x86_64-linux-android",
# iOS (device + simulator)
"aarch64-apple-ios",
"aarch64-apple-ios-sim",
"x86_64-apple-ios",
# Windows
"aarch64-pc-windows-msvc",
"x86_64-pc-windows-msvc",
# Linux
"aarch64-unknown-linux-gnu",
"x86_64-unknown-linux-gnu",
# macOS
"aarch64-apple-darwin",
"x86_64-apple-darwin",
]
의존성 목록 2 개
^8.9.0^11.0.0사용 목적에 따라 검색하고 개발 활동을 비교한 뒤 원본 저장소에서 요구 사항을 확인하세요.
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗