Struct bytes::SliceBuf [] [src]

pub struct SliceBuf<T> { /* fields omitted */ }

A Buf backed by a contiguous region of memory.

This Buf is better suited for cases where there is a clear delineation between reading and writing.

Methods

impl<T: AsRef<[u8]>> SliceBuf<T>
[src]

Creates a new SliceBuf wrapping the provided 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

Trait Implementations

impl<T> Buf for SliceBuf<T> where T: AsRef<[u8]>
[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<T> BufMut for SliceBuf<T> where T: AsRef<[u8]> + AsMut<[u8]>
[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<T> Debug for SliceBuf<T> where T: AsRef<[u8]>
[src]

Formats the value using the given formatter.

impl<T> Write for SliceBuf<T> where T: AsRef<[u8]> + AsMut<[u8]>
[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