WasmtimeFableRaytracerFSharpAvalonia
F# code transpiled to Rust, compiled to WASM, running in Avalonia app inside Wasmtime WASI Runtime
Install / Use
/learn @delneg/WasmtimeFableRaytracerFSharpAvaloniaREADME
Wasmtime executing WASM code in Avalonia.FuncUI desktop app generated by Fable Rust and wasm-pack
Fully F# all the way
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/
Preview

Fable
This project uses Fable 4 Snake Island Preview.
Please check out this blog post for more info.
Wasmtime
This project uses wasmtime-dotnet to execute Wasm.
Please check out wasmtime website for more info.
Pre-requisites
-
install .NET 7
-
Optionally, install Node.js & npm in order to run
package.jsonscript
Build & Run
Using npm
npm run run
Manually
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
Why ?
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.
