44<a href =" https://opensource.org/licenses/MIT " ><img src =" https://img.shields.io/badge/license-MIT-purple.svg " alt =" MIT License " ></a >
55</p >
66
7- # native_toolchain_rs
87Rust support for Dart's Native Assets.
98
10- ---
11-
129## Why native_toolchain_rs?
13101 . It's opinionated.
1411 That might sound bad, but it's opinionated in the way that _ keeps you from shooting yourself in the foot_ .
@@ -29,7 +26,7 @@ Rust support for Dart's Native Assets.
2926## Code Setup
3027` native_toolchain_rs ` will look (by default) for ` native/ ` or ` rust/ ` (customizable)
3128in your Dart package's root.
32- Create a ` Cargo.toml ` and ` rust-toolchain.toml ` in your chosen Rust sources directory;
29+ If you haven't already, create a ` Cargo.toml ` and ` rust-toolchain.toml ` in your chosen Rust directory;
3330keep reading for what these two files must contain
3431(but don't worry if you forget, you'll get a helpful error message).
3532
@@ -64,11 +61,7 @@ void main(List<String> args) async {
6461 await RustBuilder(
6562 assetName: 'src/my_ffi_bindings.g.dart',
6663 // ...maybe enable some Cargo features or something in here too
67- ).run(
68- input: input,
69- output: output,
70- logger: logger,
71- );
64+ ).run(input: input, output: output, logger: logger);
7265 });
7366}
7467```
@@ -77,7 +70,7 @@ void main(List<String> args) async {
7770Keep at least the following in your ` Cargo.toml ` .
7871``` toml
7972[package ]
80- name = " my-crate-name" # name it whatever you want , doesn't matter
73+ name = " my-crate-name" # pick a name , doesn't matter
8174
8275[lib ]
8376crate-type = [" staticlib" , " cdylib" ] # THESE ARE IMPORTANT!
@@ -87,7 +80,9 @@ crate-type = ["staticlib", "cdylib"] # THESE ARE IMPORTANT!
8780Keep at least the following in your ` rust-toolchain.toml ` .
8881``` toml
8982[toolchain ]
90- channel = " 1.90.0" # or newer, but *do not* use stable, beta, or nightly alone (without a version number)!
83+ # WARNING: *do not* use `stable`, `beta`, or `nightly` (alone) for the channel!
84+ # You must specify a version number/date in order to ensure reproducible builds.
85+ channel = " 1.90.0" # or newer. another example: `nightly-2025-01-01`
9186
9287# The targets you want to support; these are the default:
9388targets = [
0 commit comments