Fable Rust Raytracer demo made by @ncave (https://github.com/ncave/fable-raytracer), also check out iOS Static library version https://github.com/delneg/fable-raytracer-ios-net6/
This project uses Fable 4 Snake Island Preview.
Please check out this blog post for more info.
This project uses wasmtime-dotnet to execute Wasm.
Please check out wasmtime website for more info.
-
install .NET 7
-
Optionally, install Node.js & npm in order to run
package.json
script
npm run run
dotnet tool restore
dotnet fable FableRustRaytracer/FableRustRaytracer.fsproj --lang rust --outDir FableRustRaytracer/
# this throws an error, but it's safe to ignore
# ./FableRustRaytracer/RayTracer.fs(157,34): (157,69) error FABLE: System.Double.Pow is not supported by Fable
wasm-pack build FableRustRaytracer/ --target nodejs
dotnet run --project WasiFableRaytracerFSharpAvalonia/WasiFableRaytracerFSharpAvalonia.fsproj
Because why not. An example use case for this may be some existing WASM code that you want to use in your desktop app or for example some .NET code that performs better when compiled to Rust and then WASM.