Expand description
buffer
provides safe, write-only and generics-free byte buffers that can
be used without initializing them first.
The main trait of this library is Buffer
that represents a type that can
contain uninitialized bytes (such as Vec
, ArrayVec
, etc.) and can
safely be read into (e.g. using ReadBuffer
).
In order to keep code sizes down, such a type implementing Buffer
is
quickly converted into the struct BufferRef
, so this is the type
receivers of types implementing Buffer
s should work with.
An example for the usage of this trait can be found with ReadBuffer
which
implements reading into a buffer without initializing it first.
Structs§
- Array
VecBuffer - The intermediate step from a
ArrayVec
to aBufferRef
. - Buffer
Ref - A reference to an uninitialized or partially initialized byte buffer.
- Buffer
RefBuffer - The intermediate step from a
BufferRef
to anotherBufferRef
. - CapAt
- The result of a
cap_at
call on a buffer. - CapAt
Buffer - The intermediate step from a
CapAt
to aBufferRef
. - Capacity
Error - An error occuring when too many bytes are being pushed into a buffer.
- Slice
Buffer - The intermediate step from a byte slice to a
BufferRef
. - Slice
RefBuffer - The intermediate step from a byte slice reference to a
BufferRef
. - VecBuffer
- The intermediate step from a
Vec
to aBufferRef
.
Traits§
- Buffer
- Trait for types that can act as buffer for bytes.
- Read
Buffer - Trait to read to
T: Buffer
. - Read
Buffer Marker - An internal trait to be implemented by
T: Read
which do not access the read buffer inRead::read
. - Read
Buffer Ref - An internal trait to be implemented by
T: Read
which do not access the read buffer inRead::read
. Prefer implementingReadBufferMarker
over this. - ToBuffer
Ref - Internal trait for the intermediate result of converting a
T: Buffer
into aBufferRef
.
Functions§
- read_
buffer_ ⚠ref - A utility function for unsafely implementing
ReadBufferRef
for readers that don’t read the buffer passed toRead::read
. - with_
buffer - Convenience function that converts a
T: Buffer
into aBufferRef
.