Skip to content

Commit 8369edd

Browse files
author
Maxime Mangel
committed
Add really basic Rust instruction for getting started section
1 parent 9d6ff6f commit 8369edd

File tree

2 files changed

+58
-3
lines changed

2 files changed

+58
-3
lines changed

docs/docs/getting-started/Rust.md

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,61 @@ title: Rust
33
layout: standard
44
---
55

6+
:::warning
7+
Rust target is in alpha meaning that not everything is supported and breaking changes can happen.
8+
:::
9+
610
:::info
7-
This section is under construction.
8-
:::
11+
Please make sure you followed the [Fable setup guide](/docs/2-steps/your-first-fable-project) before continuing.
12+
:::
13+
14+
15+
<ul class="textual-steps">
16+
17+
<li>
18+
19+
Create a `Cargo.toml` file with the following content:
20+
21+
```toml
22+
[package]
23+
name = "fable-rust-sample"
24+
version = "0.1.0"
25+
edition = "2021"
26+
27+
[[bin]]
28+
name = "program"
29+
path = "Program.fs.rs"
30+
31+
[dependencies]
32+
fable_library_rust = { path = "./fable_modules/fable-library-rust" }
33+
```
34+
35+
</li>
36+
37+
<li>
38+
39+
Change `Program.fs` to the following:
40+
41+
```fs
42+
[<EntryPoint>]
43+
let main args =
44+
printfn "Hello from F#"
45+
0
46+
```
47+
48+
</li>
49+
50+
<li>
51+
52+
Compile your code using Fable and run it using Rust.
53+
54+
```bash
55+
dotnet fable --lang rust
56+
cargo run
57+
```
58+
59+
You should see `Hello from F#` in your terminal.
60+
61+
</li>
62+
63+
</ul>

docs/docs/getting-started/your-first-fable-project.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ To go further look into the respective target documentation to have an example o
8282
- [JavaScript](/docs/getting-started/javascript.html)
8383
- [TypeScript](/docs/getting-started/typescript.html)
8484
- [Python](/docs/getting-started/python.html)
85-
<!-- - [Dart](/docs/getting-started/dart.html)
8685
- [Rust](/docs/getting-started/rust.html)
86+
<!-- - [Dart](/docs/getting-started/dart.html)
8787
- [PHP](/docs/getting-started/php.html) -->
8888

8989
</li>

0 commit comments

Comments
 (0)