Struct appendbuf::AppendBuf [] [src]

pub struct AppendBuf {
    // some fields omitted
}

An append-only, atomically reference counted buffer.

Methods

impl AppendBuf
[src]

fn new(len: usize) -> AppendBuf

Create a new, empty AppendBuf with the given capacity.

fn slice(&self) -> Slice

Create a new Slice of the entire AppendBuf so far.

fn remaining(&self) -> usize

Retrieve the amount of remaining space in the AppendBuf.

fn fill(&mut self, buf: &[u8]) -> usize

Write the data in the passed buffer onto the AppendBuf.

This is an alternative to using the implementation of std::io::Write which does not unnecessarily use Result.

fn get_write_buf(&mut self) -> &mut [u8]

Get the remaining space in the AppendBuf for writing.

If you wish the see the data written in subsequent Slices, you must also call advance with the amount written.

Reads from this buffer are reads into uninitalized memory, and so should be carefully avoided.

unsafe fn advance(&mut self, amount: usize)

Advance the position of the AppendBuf.

You should only advance the buffer if you have written to a buffer returned by get_write_buf.

Trait Implementations

impl Send for AppendBuf
[src]

impl Sync for AppendBuf
[src]

impl Write for AppendBuf
[src]

fn write(&mut self, buf: &[u8]) -> Result<usize>

Write a buffer into this object, returning how many bytes were written. Read more

fn flush(&mut self) -> Result<()>

Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more

fn write_all(&mut self, buf: &[u8]) -> Result<()Error>
1.0.0

Attempts to write an entire buffer into this write. Read more

fn write_fmt(&mut self, fmt: Arguments) -> Result<()Error>
1.0.0

Writes a formatted string into this writer, returning any error encountered. Read more

fn by_ref(&mut self) -> &mut Self
1.0.0

Creates a "by reference" adaptor for this instance of Write. Read more

impl Drop for AppendBuf
[src]

fn drop(&mut self)

A method called when the value goes out of scope. Read more