diff --git a/includes/std/array.pat b/includes/std/array.pat index 444bdba..8a69b44 100644 --- a/includes/std/array.pat +++ b/includes/std/array.pat @@ -6,6 +6,22 @@ import std.core; /*! The array library contains a helper type to make it easier to create multi-dimensional arrays and pass arrays to functions as parameters. + + ## Multi-dimensional arrays + + The following example shows how to use multi-dimensional arrays with structs. + + ```rust + import std.array; + + struct File { + u8 width, height; + std::Array, height> cells; + }; + + File file @ 0x00; + ``` + */ namespace auto std { @@ -27,7 +43,7 @@ namespace auto std { struct ByteSizedArray { u64 startAddress = $; T array[while($ - startAddress < NumBytes)] [[inline]]; - + std::assert($ - startAddress == NumBytes, "Not enough bytes available to fit a whole number of types"); } [[format("std::impl::format_array")]];