Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,20 @@ on:
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- 1.63.0
- 1.71.0
- stable
- nightly

os:
- "ubuntu-latest"
- "macos-latest"
- "windows-latest"

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "ads"
version = "0.4.4"
version = "0.5.0"
edition = "2018"
authors = ["Georg Brandl <g.brandl@fz-juelich.de>"]
license = "MIT/Apache-2.0"
description = "Client for the Beckhoff Automation Device Specification protocol for PLCs"
repository = "https://github.com/birkenfeld/ads-rs"
keywords = ["Beckhoff", "ADS", "automation", "device", "PLC"]
rust-version = "1.63"
rust-version = "1.71"

[dependencies]
byteorder = "1.5.0"
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ Use with Cargo as usual, no system dependencies are required.

```toml
[dependencies]
ads = "0.4"
ads = "0.5"
```

### Rust version

Minimum supported Rust version is 1.63.0.
Minimum supported Rust version is 1.71.0.

## Usage

Expand Down Expand Up @@ -68,3 +68,4 @@ routes automatically.

A utility called `adstool` is found under `examples/`, very similar to the one
provided by [the C++ library](https://github.com/Beckhoff/ADS).

17 changes: 16 additions & 1 deletion src/test/test_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,24 @@ fn test_timeout() {
run_test(
ServerOpts { timeout: Some(Duration::from_millis(1)), ..Default::default() },
|device| {
use std::io::ErrorKind;
let err = device.get_info().unwrap_err();

// darwin (maybe other BSDs too?) kernel seems to return `WouldBlock` on timeout
// linux/windows align on returning `TimedOut`, which makes more sense semantically
let expected_err = {
#[cfg(target_os = "macos")]
{
ErrorKind::WouldBlock
}
#[cfg(not(target_os = "macos"))]
{
ErrorKind::TimedOut
}
};

match err {
Error::Io(_, err) if matches!(err.kind(), std::io::ErrorKind::TimedOut) => (),
Error::Io(_, err) if err.kind() == expected_err => (),
_ => panic!("unexpected error from timeout: {}", err),
}
},
Expand Down