pub trait SocketBuffer:
Clone
+ Debug
+ Default {
// Required methods
fn new() -> Self
where Self: Sized;
fn append_buffer(&mut self, buf: &[u8]);
fn shift_left_buffer(&mut self, amount: usize);
fn as_slice(&self) -> &[u8];
fn len(&self) -> usize;
// Provided methods
fn clear(&mut self) { ... }
fn is_empty(&self) -> bool { ... }
}
Expand description
A trait for a buffer that can be used with a socket.
It can be used by either a read or write buffer of a socket.
Required Methods§
Sourcefn append_buffer(&mut self, buf: &[u8])
fn append_buffer(&mut self, buf: &[u8])
Sourcefn shift_left_buffer(&mut self, amount: usize)
fn shift_left_buffer(&mut self, amount: usize)
Shift the buffer to the left by amount
This is used to remove data from the buffer.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.