diff --git a/source/coral/io.cpp b/source/coral/io.cpp index 07e1bd8..8a357e6 100644 --- a/source/coral/io.cpp +++ b/source/coral/io.cpp @@ -10,6 +10,16 @@ export namespace coral { template struct fixed_buffer : public writer, public reader { fixed_buffer(coral::u8 fill_value) : data{fill_value} {} + /** + * Returns a mutable [slice] ranging from the head to the last-filled element. + * + * *Note*: The lifetime and validity of the returned slice is only guaranteed for as long + * as the source [fixed_buffer] is not mutated or out-of-scope. + */ + slice as_slice() const { + return {0, this->filled}; + } + /** * Returns the base pointer of the buffer data. */