Skip to content

F# code transpiled to Rust, compiled to WASM, running in Avalonia app inside Wasmtime WASI Runtime

License

Notifications You must be signed in to change notification settings

delneg/WasmtimeFableRaytracerFSharpAvalonia

Repository files navigation

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

gif

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

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.

About

F# code transpiled to Rust, compiled to WASM, running in Avalonia app inside Wasmtime WASI Runtime

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published