Struct hprose::io::ByteWriter
[−]
[src]
pub struct ByteWriter { pub vec: Bytes, }
Fields
vec: Bytes
Methods
impl ByteWriter
[src]
fn new() -> ByteWriter
Constructs a new ByteWriter
.
fn into_bytes(self) -> Bytes
Converts a ByteWriter
into a byte vector.
This consumes the ByteWriter
, so we do not need to copy its contents.
fn as_bytes(&self) -> &[u8]
Returns a byte slice of this ByteWriter
's contents.
fn as_string(&self) -> Result<String, FromUtf8Error>
Converts the contents of a ByteWriter
to a String
.
Errors
Returns Err
if the slice is not UTF-8 with a description as to why the
provided bytes are not UTF-8. The vector you moved in is also included.
fn clear(&mut self)
Clears the vector, Removing all bytes.
fn len(&self) -> usize
Returns the number of bytes in the vector.
fn write_byte(&mut self, b: u8)
Writes a byte to the end of the vector.
Panics
Panics if the number of elements in the vector overflows a usize
.
fn write(&mut self, bytes: &[u8])
Writes all the bytes to the end of the vector.
Panics
Panics if the number of elements in the vector overflows a usize
.