Created
March 19, 2021 20:54
-
-
Save alexcrichton/bd3983b363e8f899c278caf5557b5cab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; documentation comment | |
type $my_record = record { | |
;; field documentation | |
field1: u32, | |
field2: $other_record, | |
field3: list[string], | |
field4: in-buffer[u8], | |
} | |
;; comment on this type | |
type $other_record = (f32, f64) | |
type $errno = variant { | |
invalid, | |
too_big(string), | |
way_too_big($my_record) | |
} | |
;; importing types from other modules | |
use $other_type from $other_module | |
fn the_meaning_of_life() -> u32; | |
fn read( | |
fd: handle $fd, | |
buf: out-buffer[u8] | |
) -> result[u32, $errno]; | |
fn write( | |
fd: handle $fd, | |
buf: in-buffer[u8] | |
) -> result[u32, $errno]; | |
fn multivalue_return() -> u32, u64; | |
fn tuple_return() -> (u32, u64); | |
;; documentation on functions | |
fn what_in_the_world(record: $my_record); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment