Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions docs/writeups/0013-calling-rust-functions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# WU0013: Calling Rust functions

## Syntax experimentation

```rust
fn foo() -> i32 { 15 }
fn bar(a: i32, c: i32) -> i32 { a + c }
```

```rust
where rust = source("rust");
where i32 = rust.i32;
where Fn = rust.Fn;

where foo_type = rust.fn("foo", return_type: i32).build();
where bar_type = rust.fn("bar", args: (i32, i32), return_type: i32).build();

where foo_type = Fn[(), i32](name: "foo");
where bar_type = Fn[(i32, i32), i32](name: "bar");
```