패키지, 저장소 및 앱 카테고리 검색

패키지 상세v1.1.1

native_toolchain_rust

Dart 빌드 훅을 위한 Rust 지원. Rust 코드를 Dart 코드와 함께 자동으로 빌드하고 번들링합니다!

AndroidiOSLinuxmacOSWindows
30일 다운로드
8.4만
좋아요
29
Pub 점수
160

패키지 설치

flutter pub add native_toolchain_rust

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Flutter/Dart 패키지로, Dart 프로젝트에 Rust 코드를 원활하게 통합할 수 있게 해줍니다. 빌드 훅을 사용하여 Rust 라이브러리를 자동으로 컴파일하고 Dart 코드와 함께 번들링함으로써 다중 언어 개발을 간소화합니다. 암호화, 데이터 처리 또는 시스템 수준 작업과 같은 성능이 중요한 구성 요소에 적합합니다. Android, iOS, Linux, macOS, Windows 등 모든 주요 플랫폼을 지원합니다.

사용 사례

  • 고성능 러스트 라이브러리를 Flutter 앱에 통합하기
  • Rust로 암호 기능 구축하기
  • 데이터 집약적인 계산 최적화
  • 플랫폼별 네이티브 확장 만들기
  • 안전한 저수준 시스템 접근 활성화

주요 기능

  • 빌드 훅을 통한 자동 루스트 컴파일
  • 크로스 플랫폼 지원 (Android, iOS, Linux, macOS, Windows)
  • 무결점 Dart-Rust 상호 운용성
  • 최소한의 보일러플레이트 설정
  • 내장된 종속성 관리

적합한 대상

  • Flutter에서 고성능 네이티브 코드가 필요한 개발자
  • 핵심 로직에 루스트를 사용하는 팀
  • 보안성과 빠른 계산이 필요한 프로젝트
  • 크로스 플랫폼 네이티브 확장
  • Rust 통합을 탐색하는 Dart 개발자

고려 사항

  • 호스트 머신에 루스트 툴체인을 설치해야 합니다
  • Rust 컴파일로 인해 빌드 시간이 증가할 수 있습니다
  • Rust 코드에 대한 디버깅 지원이 제한적
  • 플랫폼별 빌드 구성이 필요할 수 있습니다
  • Rust 초보자들을 위한 학습 곡선

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

🧱 native_toolchain_rust 🦀

Build Status Github Stars MIT License


Rust support for Dart's build hooks.

Why native_toolchain_rust?

  1. It's opinionated. That might sound bad, but it's opinionated in the way that keeps you from shooting yourself in the foot.
  2. Does more with less. The API is incredibly easy to use: the only thing you need to provide is assetName, and the rest is auto-magically figured out. (But you can still tweak the functionality as much as you need to!)

Getting Started

  1. Install rustup, for Rust, on your development computer (if you are a library author, consumers of your package will have to do the same)
  2. Run flutter pub add native_toolchain_rust hooks for Flutter or dart pub add native_toolchain_rust hooks for Dart-only
  3. See Code Setup

Code Setup

native_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.dart
import '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.toml

Keep 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.toml

Keep 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",
]

카테고리

의존성

의존성 목록 6 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.

순위