From 7c9be2151d0203d177b13afe7409aa7feb1a13e6 Mon Sep 17 00:00:00 2001 From: Jeff Date: Tue, 30 Jan 2024 14:48:38 -0500 Subject: [PATCH] Write docs; Add missing docs warning --- docs/language.md | 35 ++++++++++++++++++++++++----------- src/lib.rs | 2 ++ 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/docs/language.md b/docs/language.md index 51997a8..611ead0 100644 --- a/docs/language.md +++ b/docs/language.md @@ -353,9 +353,22 @@ stdout_message = new Message { The `option(type)` type is expected to be either `some(value)` or `none`. The type of the value inside the `some` is always specified. +```dust +result = none + +for file in fs:read_dir("./") { + if file:size > 100 { + result = some(file:path) + break + } +} + +output(result) +``` + ```dust get_line_break_index(text ) { - str:find(text, '\n') + str:find(text, '\n') } ``` @@ -364,20 +377,20 @@ get_line_break_index(text ) { Custom types such as **structures** are referenced by their variable identifier. ```dust -struct File { - path - size - type +File = struct { + path + size + type } print_file_info(file ) { - info = file:path - + '\n' - + file:size - + '\n' - + file:type + info = file:path + + '\n' + + file:size + + '\n' + + file:type - output(info) + output(info) } ``` diff --git a/src/lib.rs b/src/lib.rs index abafae2..4cd3a04 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,5 @@ +#![warn(missing_docs)] + //! The Dust library is used to parse, format and run dust source code. //! //! See the [interpret] module for more information.