Rust target is in alpha meaning that not everything is supported and breaking changes can happen.

  • Create a Cargo.toml file with the following content:

    name = "fable-rust-sample"
    version = "0.1.0"
    edition = "2021" 
    name = "program"
    path = ""
    fable_library_rust = { path = "./fable_modules/fable-library-rust" }
  • Change Program.fs to the following:

    let main args = 
        printfn "Hello from F#"
  • Compile your code using Fable and run it using Rust.

    dotnet fable --lang rust
    cargo run

    You should see Hello from F# in your terminal.