Demo
Some scenarios when using Rust and Dart include:
- Use arbitrary Rust libraries, in Dart: When there is a library only existing in Rust but not in Dart.
- High-performance code in Rust, others in Dart: Rust makes it easy to write multi-thread code, algorithms, data-intensive operations, etc.
- Logic in Rust, UI in Dart: When you want a UI framework (Flutter) for your Rust system.
Introduction
We demonstrate a simple example here. In this demo, let us draw a Mandelbrot set (a well-known infinite-resolution "image" generated by a simple math formula). The image is plotted in Flutter UI, generated by Rust algorithm, and communicated via this library. Tweak the number of threads to see how multi-thread Rust code speeds up :)
What is a Mandelbrot Set
The Mandelbrot set is the set of complex numbers c
for which the function f_c(z)=z^{2}+c
does not diverge to infinity when iterated from z=0
.
Images of the Mandelbrot set exhibit an elaborate and infinitely complicated boundary
that reveals progressively ever-finer recursive detail at increasing magnifications.
Image credit: Simpsons contributor
Demo
Due to the limitation of GitHub Pages which hosts this documentation, this page will be auto refreshed once.
All source code can be found in frb_example/gallery.
Remember to ignore all ignore_me
folders, which contain code unrelated to the purpose of the demos.