| Crates.io | ni-visa-bindings |
| lib.rs | ni-visa-bindings |
| version | 1.0.1 |
| created_at | 2025-01-09 15:35:43.787353+00 |
| updated_at | 2025-01-15 19:10:56.024755+00 |
| description | Raw Rust bindings to the NI-VISA library, providing low-level access to the National Instruments Virtual Instrument Software Architecture (VISA) API for instrument control and communication. |
| homepage | |
| repository | https://github.com/glyad/ni-visa-bindings/ |
| max_upload_size | |
| id | 1510052 |
| size | 34,236 |
ni-visa-bindings provides raw Rust bindings to the National Instruments Virtual Instrument Software Architecture (NI-VISA) library. This crate enables low-level access to the VISA API for instrument control and communication, making it a foundational component for building higher-level abstractions in Rust.
There are two ways to add the crate to your project dependencies:
Cargo.toml:[dependencies]
ni-visa-bindings = "1.0.0"
cargo add ni-visa-bindings
You will also need to have the NI-VISA library installed on your system.
This crate exposes the raw bindings to the NI-VISA library. Below is an example of how to initialize a VISA session using these bindings:
use ni_visa_bindings::*;
fn main() {
unsafe {
let mut default_rm: ViSession = 0;
let status = viOpenDefaultRM(&mut default_rm);
if status < VI_SUCCESS {
eprintln!("Failed to open default resource manager. Status: {}", status);
} else {
println!("Default resource manager opened successfully.");
// Perform additional VISA operations here...
// Close the resource manager
viClose(default_rm);
}
}
}
Additionally, you can refer to the tests provided in the source code as an excellent knowledge source. These tests demonstrate various usages of the bindings and serve as practical examples to guide development.
Full API documentation is available on docs.rs.
Contributions are welcome! If you encounter a bug, have a feature request, or want to improve the code, feel free to open an issue or submit a pull request.
git clone https://github.com/<your-username>/ni-visa-bindings.git
cd ni-visa-bindings
cargo build
cargo test
| | Implemented in | Implemented in |
| Feature | Original Library | crate |
|----------------------------------|-------------------|-----------------|
| Provide the same functionality, | | |
| as in original library | ✅ | ✅ |
| Documentation | ✅ | ⬜ |
| Expanded test coverage | ⬜ | ⬜ |
| Add more comprehancive examples | ⬜ | ⬜ |
Contributions and suggestions for the roadmap are welcome! Feel free to open an issue or discussion.
This project is licensed under the Unlicense License.
This crate is not officially affiliated with or endorsed by National Instruments. It is an independent open-source project.