kvarn_utils::prelude::io

Struct BorrowedCursor

source
pub struct BorrowedCursor<'a> { /* private fields */ }
🔬This is a nightly-only experimental API. (core_io_borrowed_buf)
Expand description

A writeable view of the unfilled portion of a BorrowedBuf.

The unfilled portion consists of an initialized and an uninitialized part; see BorrowedBuf for details.

Data can be written directly to the cursor by using append or indirectly by getting a slice of part or all of the cursor and writing into the slice. In the indirect case, the caller must call advance after writing to inform the cursor how many bytes have been written.

Once data is written to the cursor, it becomes part of the filled portion of the underlying BorrowedBuf and can no longer be accessed or re-written by the cursor. I.e., the cursor tracks the unfilled part of the underlying BorrowedBuf.

The lifetime 'a is a bound on the lifetime of the underlying buffer (which means it is a bound on the data in that buffer by transitivity).

Implementations§