pub struct AsyncInstrument { /* private fields */ }Expand description
An Instrument wired up for asynchronous transfers.
Implementations§
Source§impl AsyncInstrument
impl AsyncInstrument
Sourcepub fn new(instr: Instrument) -> Result<Self>
pub fn new(instr: Instrument) -> Result<Self>
Wraps instr for asynchronous use.
Enables termination-character and END detection. These settings remain in
effect when converted back into an Instrument.
pub fn instrument(&self) -> &Instrument ⓘ
Sourcepub fn async_read(&self, timeout: Duration) -> AsyncRead<'_> ⓘ
pub fn async_read(&self, timeout: Duration) -> AsyncRead<'_> ⓘ
Reads one complete response, resolving to the bytes received.
Stops at the termination character or END indicator. timeout applies to each
underlying read, not the total time to receive the response.
For binary block data, whose bytes may legitimately include the termination
character, use Self::async_read_exact instead.
Starting another operation while one is in progress may return
ErrorInProgress.
Sourcepub fn async_read_exact(&self, len: usize, timeout: Duration) -> AsyncRead<'_> ⓘ
pub fn async_read_exact(&self, len: usize, timeout: Duration) -> AsyncRead<'_> ⓘ
Reads exactly len bytes, resolving to them.
Disables termination-character detection for binary data. Short reads are
continued until len bytes arrive; a zero-byte read before then returns
ErrorIo.
timeout applies to each underlying read, not the total operation.
Read settings persist on the session. VISA errors and timeouts are returned immediately.
Sourcepub fn async_write(&self, buf: impl Into<Vec<u8>>) -> AsyncWrite<'_> ⓘ
pub fn async_write(&self, buf: impl Into<Vec<u8>>) -> AsyncWrite<'_> ⓘ
Writes buf, waiting for completion and returning the number of bytes written.
Accepts inputs convertible to Vec<u8>, including byte slices, Vec<u8>, and
String. Check the returned count for a short write.