Skip to main content

AsyncInstrument

Struct AsyncInstrument 

Source
pub struct AsyncInstrument { /* private fields */ }
Expand description

An Instrument wired up for asynchronous transfers.

Implementations§

Source§

impl AsyncInstrument

Source

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.

Source

pub fn instrument(&self) -> &Instrument ⓘ

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Drop for AsyncInstrument

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl From<AsyncInstrument> for Instrument

Source§

fn from(async_instr: AsyncInstrument) -> Self

Converts to this type from the input type.
Source§

impl From<AsyncInstrument> for InstrumentTokioAdapter

Source§

fn from(value: AsyncInstrument) -> Self

Converts to this type from the input type.
Source§

impl From<InstrumentTokioAdapter> for AsyncInstrument

Source§

fn from(value: InstrumentTokioAdapter) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.