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
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Builder
impl !RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl !UnwindSafe for Builder
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