Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<p align="center">
<a href="https://github.com/GregoryConrad/native_toolchain_rs/actions"><img src="https://github.com/GregoryConrad/native_toolchain_rs/actions/workflows/build.yml/badge.svg" alt="Build Status"></a>
<a href="https://github.com/GregoryConrad/native_toolchain_rs"><img src="https://img.shields.io/github/stars/GregoryConrad/native_toolchain_rs.svg?style=flat&logo=github&colorB=deeppink&label=stars" alt="Github Stars"></a>
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/license-MIT-purple.svg" alt="MIT License"></a>
</p>
# 🧱 `native_toolchain_rs` 🦀

# native_toolchain_rs
Rust support for Dart's Native Assets.
[![Build Status](https://github.com/GregoryConrad/native_toolchain_rs/actions/workflows/build.yml/badge.svg)](https://github.com/GregoryConrad/native_toolchain_rs/actions)
[![Github Stars](https://img.shields.io/github/stars/GregoryConrad/native_toolchain_rs.svg?style=flat&logo=github&colorB=deeppink&label=stars)](https://github.com/GregoryConrad/native_toolchain_rs)
[![MIT License](https://img.shields.io/badge/license-MIT-purple.svg)](https://opensource.org/licenses/MIT)

---

Rust support for Dart's Native Assets.

## Why native_toolchain_rs?
1. It's opinionated.
That might sound bad, but it's opinionated in the way that _keeps you from shooting yourself in the foot_.
Expand All @@ -29,7 +28,7 @@ Rust support for Dart's Native Assets.
## Code Setup
`native_toolchain_rs` will look (by default) for `native/` or `rust/` (customizable)
in your Dart package's root.
Create a `Cargo.toml` and `rust-toolchain.toml` in your chosen Rust sources directory;
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).

Expand Down Expand Up @@ -64,11 +63,7 @@ void main(List<String> args) 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,
logger: logger,
);
).run(input: input, output: output, logger: logger);
});
}
```
Expand All @@ -77,7 +72,7 @@ void main(List<String> args) async {
Keep at least the following in your `Cargo.toml`.
```toml
[package]
name = "my-crate-name" # name it whatever you want, doesn't matter
name = "my-crate-name" # pick a name, doesn't matter

[lib]
crate-type = ["staticlib", "cdylib"] # THESE ARE IMPORTANT!
Expand All @@ -87,7 +82,9 @@ crate-type = ["staticlib", "cdylib"] # THESE ARE IMPORTANT!
Keep at least the following in your `rust-toolchain.toml`.
```toml
[toolchain]
channel = "1.90.0" # or newer, but *do not* use stable, beta, or nightly alone (without a version number)!
# 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 = [
Expand Down