pub struct Stream { /* private fields */ }
Expand description
Dynamically sized inmemory stream.
Used as buffer with read, write and peek funcs.
Implementations§
Source§impl Stream
impl Stream
Sourcepub fn with_capacity(capacity: usize) -> Stream
pub fn with_capacity(capacity: usize) -> Stream
Create new Stream with target capacity.
Sourcepub fn truncate_readied(&mut self)
pub fn truncate_readied(&mut self)
Clear bytes that have been read. Has no effect on the allocated capacity.
Sourcepub fn truncate_capacity(&mut self)
pub fn truncate_capacity(&mut self)
Truncate the capacity of the stream as much as possible.
Trait Implementations§
Source§impl TRead for Stream
impl TRead for Stream
Source§fn peek_byte(&self) -> Result<u8, StreamError>
fn peek_byte(&self) -> Result<u8, StreamError>
Peek one byte from stream, position don’t shift.
Can return EOF error.
Source§fn peek(&self, buffer: &mut [u8]) -> Result<usize, StreamError>
fn peek(&self, buffer: &mut [u8]) -> Result<usize, StreamError>
Peek bytes from stream, position don’t shift.
Can return EOF, ZeroLength errors.
Source§fn read_byte(&mut self) -> Result<u8, StreamError>
fn read_byte(&mut self) -> Result<u8, StreamError>
Read one byte from stream, position shifted.
Can return EOF error.
Source§fn read(&mut self, buffer: &mut [u8]) -> Result<usize, StreamError>
fn read(&mut self, buffer: &mut [u8]) -> Result<usize, StreamError>
Read bytes from stream, position shifted.
Can return EOF, ZeroLength errors.
Auto Trait Implementations§
impl Freeze for Stream
impl RefUnwindSafe for Stream
impl Send for Stream
impl Sync for Stream
impl Unpin for Stream
impl UnwindSafe for Stream
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more