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:

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

    [<EntryPoint>]
    let main args = 
        printfn "Hello from F#"
        0
  • 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.