Struct tokio_test::io::Builder
source · pub struct Builder { /* private fields */ }Expand description
Builds Mock instances.
Implementations§
source§impl Builder
impl Builder
sourcepub fn read(&mut self, buf: &[u8]) -> &mut Self
pub fn read(&mut self, buf: &[u8]) -> &mut Self
Sequence a read operation.
The next operation in the mock’s script will be to expect a read call
and return buf.
sourcepub fn read_error(&mut self, error: Error) -> &mut Self
pub fn read_error(&mut self, error: Error) -> &mut Self
Sequence a read operation that produces an error.
The next operation in the mock’s script will be to expect a read call
and return error.
sourcepub fn write(&mut self, buf: &[u8]) -> &mut Self
pub fn write(&mut self, buf: &[u8]) -> &mut Self
Sequence a write operation.
The next operation in the mock’s script will be to expect a write
call.
sourcepub fn write_error(&mut self, error: Error) -> &mut Self
pub fn write_error(&mut self, error: Error) -> &mut Self
Sequence a write operation that produces an error.
The next operation in the mock’s script will be to expect a write
call that provides error.
sourcepub fn wait(&mut self, duration: Duration) -> &mut Self
pub fn wait(&mut self, duration: Duration) -> &mut Self
Sequence a wait.
The next operation in the mock’s script will be to wait without doing so
for duration amount of time.
sourcepub fn build_with_handle(&mut self) -> (Mock, Handle)
pub fn build_with_handle(&mut self) -> (Mock, Handle)
Build a Mock value paired with a handle