Expand description
Write-only references.
Many functions in Rust’s standard library, such as char::encode_utf8
, take
a mutable reference that they only ever write to.
This crate provides a way to express this guarantee:
WriteRef<T>
provides a single method,write
. By taking this as a parameter, a function guarantees that it will only ever write to it.WriteSlice<T>
works similarly, but it allows writing only to individual elements. This is useful for functions that write to a provided buffer, such aschar::encode_utf8
.
Most functions should not take a WriteRef
or WriteSlice
directly;
instead, they should take an impl Into<WriteRef<'a, T>>
so that callers
can pass in a &mut T
.
Structs
Represents a write-only reference.
Represents a write-only buffer.