Trait object::write::WritableBuffer
source · [−]pub trait WritableBuffer {
fn len(&self) -> usize;
fn reserve(&mut self, size: usize) -> Result<(), ()>;
fn resize(&mut self, new_len: usize);
fn write_bytes(&mut self, val: &[u8]);
fn write_pod<T: Pod>(&mut self, val: &T)
where
Self: Sized,
{ ... }
fn write_pod_slice<T: Pod>(&mut self, val: &[T])
where
Self: Sized,
{ ... }
}
Expand description
Trait for writable buffer.
Required methods
Returns position/offset for data to be written at.
Should only be used in debug assertions
Reserves specified number of bytes in the buffer.
This will be called exactly once before writing anything to the buffer, and the given size is the exact total number of bytes that will be written.
Writes zero bytes at the end of the buffer until the buffer has the specified length.
fn write_bytes(&mut self, val: &[u8])
fn write_bytes(&mut self, val: &[u8])
Writes the specified slice of bytes at the end of the buffer.
Provided methods
Writes the specified Pod
type at the end of the buffer.
fn write_pod_slice<T: Pod>(&mut self, val: &[T]) where
Self: Sized,
fn write_pod_slice<T: Pod>(&mut self, val: &[T]) where
Self: Sized,
Writes the specified Pod
slice at the end of the buffer.