This crate is a first cut at an Scenic app written in Rust. It is losely based on //garnet/examples/ui/spinning_square_view.
Tilesprogram is already running. If not, start it with
run tiles_ctl -d.
tiles_ctl add spinning_square_rs_pkg. You can launch as many copies as you like, as well as
tiles_ctl add spinning_square_viewto compare Rust and C++.
If you like to hack on this program there is a faster development cycle one can use after the first build.
As a one-time setup step, run:
./scripts/fx gen-cargo //garnet/examples/ui/spinning_square_rs
This step creates a symbolic link from the source directory to the generated Cargo.toml file found on the out directory. After that, one can use:
fargo run --release --run-with-tiles
to build, scp to device and tiles_ctl add the spinning square binary.
One can build and browse the documentation for all the crates used by this program with the following command:
fargo doc --open
Currently input events are not wired up. The steps to do so would be to use the way the
ViewListenerRequestStream is monitored and set up the same thing for input services as described in //garnet/public/fidl/fuchsia.ui.views_v1/views.fidl.
So much use of
Arc<Mutex<>> is unfortunate. It would be great to find a way where it is not needed.
Integrating the approach used by Raph's xi-win for translating widgets to scenic commands is worth trying.