Struct bytes::ByteBuf [] [src]

pub struct ByteBuf { /* fields omitted */ }

A buffer backed by BytesMut

Methods

impl ByteBuf
[src]

Create a new ByteBuf with 8kb capacity

Create a new ByteBuf with cap capacity

Create a new ByteBuf backed by bytes

Create a new ByteBuf containing the given slice

Return the number of bytes the buffer can contain

Return the read cursor position

Set the read cursor position

Return the number of buffered bytes

Returns true if the buffer contains no unread bytes

Clears the buffer, removing any written data

Splits the buffer into two at the current read index.

Splits the buffer into two at the given index.

Reserves capacity for at least additional more bytes to be written in the given ByteBuf. The ByteBuf may reserve more space to avoid frequent reallocations.

Reserves the minimum capacity for exactly additional more bytes to be written in the given ByteBuf. Does nothing if the capacity is already sufficient.

Note that the allocator may give the collection more space than it requests. Therefore capacity can not be relied upon to be precisely minimal. Prefer reserve if future insertions are expected.

Gets a reference to the underlying BytesMut

Unwraps the ByteBuf, returning the underlying BytesMut

Trait Implementations

impl Buf for ByteBuf
[src]

Returns the number of bytes that can be accessed from the Buf

Returns a slice starting at the current Buf position and of length between 0 and Buf::remaining(). Read more

Advance the internal cursor of the Buf

Copies bytes from the Buf into the given slice and advance the cursor by the number of bytes copied. Read more

Returns true if there are any more bytes to consume

Copies bytes from self into dst Read more

Gets an unsigned 8 bit integer from the Buf without advancing the buffer cursor Read more

Gets an unsigned 8 bit integer from the Buf.

Gets a signed 8 bit integer from the Buf.

Gets an unsigned 16 bit integer from the Buf

Gets a signed 16 bit integer from the Buf

Gets an unsigned 32 bit integer from the Buf

Gets a signed 32 bit integer from the Buf

Gets an unsigned 64 bit integer from the Buf

Gets a signed 64 bit integer from the Buf

Gets an unsigned n-bytes integer from the Buf

Gets a signed n-bytes integer from the Buf

Gets a IEEE754 single-precision (4 bytes) floating point number from the Buf Read more

Gets a IEEE754 double-precision (8 bytes) floating point number from the Buf Read more

Creates a "by reference" adaptor for this instance of Buf

Create an adapter which will limit at most limit bytes from it.

Return a Reader for the value. Allows using a Buf as an io::Read

impl BufMut for ByteBuf
[src]

Returns the number of bytes that can be written to the BufMut

Advance the internal cursor of the BufMut

Returns a mutable slice starting at the current BufMut position and of length between 0 and BufMut::remaining(). Read more

Copies bytes from the given slice into the BufMut and advance the cursor by the number of bytes written. Returns the number of bytes written. Read more

Returns true iff there is any more space for bytes to be written

Copies bytes from src into self Read more

Writes the given string into self. Read more

Writes an unsigned 8 bit integer to the BufMut.

Writes a signed 8 bit integer to the BufMut.

Writes an unsigned 16 bit integer to the BufMut.

Writes a signed 16 bit integer to the BufMut.

Writes an unsigned 32 bit integer to the BufMut.

Writes a signed 32 bit integer to the BufMut.

Writes an unsigned 64 bit integer to the BufMut.

Writes a signed 64 bit integer to the BufMut.

Writes an unsigned n-bytes integer to the BufMut. Read more

Writes a signed n-bytes integer to the BufMut. Read more

Writes a IEEE754 single-precision (4 bytes) floating point number to the BufMut. Read more

Writes a IEEE754 double-precision (8 bytes) floating point number to the BufMut. Read more

Creates a "by reference" adaptor for this instance of BufMut

Create an adapter which will limit at most limit bytes from it.

Return a Write for the value. Allows using a BufMut as an io::Write Read more

impl Debug for ByteBuf
[src]

Formats the value using the given formatter.

impl Write for ByteBuf
[src]

Writes a slice of bytes into this writer, returning whether the write succeeded. Read more

Glue for usage of the write! macro with implementors of this trait. Read more

Writes a char into this writer, returning whether the write succeeded. Read more