Applying Rust Template
Note
This section assumes that you've already created a Flutter project with flutter create [my_app_name]
. You can get further guidance from this awesome Flutter tutorial.
First of all, add this framework to your Flutter project.
Now install the command executable to easily run Rinf commands in the CLI.1
Then, simply run this in the command-line2 from your Flutter project's directory.
After running the command, you'll have new files and folders as your starter Rust template.
my_flutter_project/
├── android/
├── ios/
├── lib/
* │ ├── main.dart
│ └── ...
├── linux/
+ ├── messages/
+ │ ├── basic.proto
+ │ └── README.md
+ ├── native/
+ │ ├── hub/
+ │ │ ├── src/
+ │ │ └── Cargo.toml
+ │ └── README.md
├── web/
├── windows/
* ├── .gitignore
+ ├── Cargo.toml
* ├── pubspec.yaml
* ├── README.md
└── ...
Various comments are written in the actual code to help you understand the whole structure.
If you already have a Rust crate that you want to use here, just put it inside ./native
and set it as a dependency of the hub
crate.
Now, by heading over to ./native/hub/src/lib.rs
, you can start writing Rust!
Example code for guidance can be found here.
Info
Rinf expects that the application's main logic is written in Rust, with Flutter solely serving the purpose of managing the GUI
-
If you're curious about all the available commands, use
rinf --help
. ↩ -
If you encounter issues with the automated
protoc
installation, likely due to GitHub API access restrictions, you can manually install it on your machine and add it to PATH. You can verify the installation by running the commandprotoc --version
to ensure that the Protobuf compiler is ready on your machine. Rinf will detect and use the manually installedprotoc
if it exists. ↩