Struct buffer::BufferRef [] [src]

pub struct BufferRef<'data, 'size> { /* fields omitted */ }

A reference to an uninitialized or partially initialized byte buffer.

It keeps track of how many bytes (from the start of the buffer) are initialized.

Methods

impl<'d, 's> BufferRef<'d, 's>
[src]

Creates a buffer reference from the buffer and a pointer where the length should be written to.

Important: initialized must initially be zero.

Advances the split of initialized/uninitialized data by num_bytes to the right.

Writes the bytes yielded by the bytes iterator into the buffer.

If the iterator yields more bytes than the buffer can contain, a CapacityError is returned.

Writes the byte slice into the buffer.

If the slice contains more bytes than the buffer can contain, a CapacityError is returned.

Returns the uninitialized part of the buffer.

Consumes the (mutable) buffer reference to produce a slice of the initialized data that is independent from the BufferRef instance.

Returns the amount of uninitialized bytes that are left.

Trait Implementations

impl<'r, 'd, 's> Buffer<'d> for &'r mut BufferRef<'d, 's>
[src]

Intermediate result of converting the T: Buffer into a BufferRef.

Converts the T: Buffer into the intermediate step to BufferRef.

Caps the buffer at the specified byte index. Read more