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.