Skip to content

VISA (Rust)

Hardware I/O goes through the visa feature (on by default) and the instrument-visa crate, which wraps visa-rs.

Install

  1. Install NI-VISA or Keysight IO Libraries.
  2. Depend on the facade crate:
[dependencies]
instrument-components = "0.1"

Linking

Variable Purpose
LIB_VISA_PATH Directory containing visa64.lib / visa.lib
LIB_VISA_NAME Library name (visa64, visa32, visa)

CI runners typically use default-features = false so they never link a native VISA library.

Discovery entry point

use instrument::prelude::*;

let catalog = Discovery::visa()?.scan()?;
catalog.print_summary();

Async: AsyncDiscovery::visa()?.scan().await? with the tokio feature. Session open is still sync; subsequent read/write are async.

Feature flags

Feature Default Description
visa yes VISA backend via instrument-visa
tokio no Async API over visa-rs tokio adapter
cross-compile no Cross-compile enum repr for visa-rs
record no Record real I/O into mock scripts
# Cross-compile example
instrument-components = { version = "0.1", features = ["visa", "cross-compile"] }
cargo build --features cross-compile --target x86_64-pc-windows-gnu

You still need a target VISA import library at link time (LIB_VISA_PATH).

Mock without VISA

instrument-components = { version = "0.1", default-features = false }

Use ScriptedFixture / DeviceCatalog::from_fixture — see getting started.