| Crates.io | rust7 |
| lib.rs | rust7 |
| version | 0.1.2 |
| created_at | 2025-08-14 09:02:44.926591+00 |
| updated_at | 2025-08-15 11:34:58.813552+00 |
| description | Native Rust S7 client (Snap7-style) for Siemens PLCs. |
| homepage | https://github.com/davenardella/rust7 |
| repository | https://github.com/davenardella/rust7 |
| max_upload_size | |
| id | 1794639 |
| size | 285,361 |
Pragmatic native Rust S7 client (Snap7‑style) for Siemens PLCs.
use rust7::client::{S7Client};
fn main() {
let mut client = S7Client::new();
let db_number: u16 = 100; // Must exist into the PLC
// Connection
match client.connect_s71200_1500("192.168.0.100") {
Ok(_) => { println!("Connected to PLC") },
Err(e) => {
eprintln!("Connection failed: {}", e);
return;
}
}
// Reads 64 byte from DB100
println!("");
println!("Attempt to read 64 byte from DB100");
let mut read_buffer = vec![0u8; 64];
match client.read_db(db_number, 0, &mut read_buffer) {
Ok(_) => {
println!("Success!");
println!("Job time (ms) : {:.3}", client.last_time);
},
Err(e) => eprintln!("Read failed: {}", e),
}
client.disconnect();
}
The detailed documentation is here.
Copyright © 2025 Davide Nardella
Distribuited under MIT License.