diff options
| author | nic-gaffney <gaffney_nic@protonmail.com> | 2023-04-18 10:42:45 -0500 |
|---|---|---|
| committer | nic-gaffney <gaffney_nic@protonmail.com> | 2023-04-18 10:42:45 -0500 |
| commit | af02ccd056754c60131d13d74b9fac0e23b2af31 (patch) | |
| tree | 16b041a84a65f2b285192f79e774b15327885bf9 /crates/sloth_vm/src/sloth_std/stdio.rs | |
| parent | 38b564380a6362a82a0e5269b1e7e3d3635900e7 (diff) | |
| download | sloth-af02ccd056754c60131d13d74b9fac0e23b2af31.tar.gz | |
Added more documentation in the native functions
Diffstat (limited to 'crates/sloth_vm/src/sloth_std/stdio.rs')
| -rw-r--r-- | crates/sloth_vm/src/sloth_std/stdio.rs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/crates/sloth_vm/src/sloth_std/stdio.rs b/crates/sloth_vm/src/sloth_std/stdio.rs index 160d012..f56b604 100644 --- a/crates/sloth_vm/src/sloth_std/stdio.rs +++ b/crates/sloth_vm/src/sloth_std/stdio.rs @@ -28,7 +28,10 @@ pub const WRITE_FUNCTION: NativeFunction = NativeFunction { function: write, arity: 1, returns_value: false, - doc: None, + doc: Some( + "NativeFunction write: \n\targs: string (str)\n\tdesc: Writes <string> to the \ + terminal.\n\tExample: `write(\"I'm sleepy...\"); # Output: I'm sleepy...`", + ), }; fn writeln(vm: &mut VM, args: &[Primitive]) -> NativeFunctionResult { @@ -55,7 +58,11 @@ pub const WRITELN_FUNCTION: NativeFunction = NativeFunction { function: writeln, arity: 1, returns_value: false, - doc: None, + doc: Some( + "NativeFunction writeln: \n\targs: string (str)\n\tdesc: Writes <string> to the terminal \ + and starts a new line.\n\tExample: `writeln(\"I'm sleepy...\"); # Output: I'm \ + sleepy...\n # This is a new line`", + ), }; fn read(vm: &mut VM, _args: &[Primitive]) -> NativeFunctionResult { @@ -76,5 +83,9 @@ pub const READ_FUNCTION: NativeFunction = NativeFunction { function: read, arity: 0, returns_value: true, - doc: None, + doc: Some( + "NativeFunction read:\n\tdesc: Reads input from the terminal and returns what was \ + read.\n\tExample: `var input = read(); # Hello World <execute code> input = 'Hello \ + World'`", + ), }; |
