An abstraction over different buffer types (Vec<u8> or BufferPool), it provides methods
for writing data from a byte slice into the buffer, with the option to either write a portion
of the data or attempt to write the entire byte slice at once.
Attempts to write all the data from a byte slice into a mutable byte array (&mut [u8]).
If the buffer is not large enough to contain all the data, an error is returned.
Attempts to write all the data from a byte slice into a Vec<u8> buffer by extending the
vector. Since Vec<u8> can dynamically resize, this method will always succeed as long
as there is available memory.