Skip to content

Commit

Permalink
Build version-dependent examples only when supported
Browse files Browse the repository at this point in the history
This apparently does not reduce noise in CI but at least allows to build
the examples with Rust 1.59.0.
  • Loading branch information
sirhcel authored and eldruin committed May 13, 2024
1 parent 7cfe68a commit c320919
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ assert_hex = "0.4.1"
clap = { version = "3.1.6", features = ["derive"] }
envconfig = "0.10.0"
rstest = { version = "0.12.0", default-features = false }
rustversion = "1.0.16"

[features]
default = ["libudev"]
Expand Down
10 changes: 10 additions & 0 deletions examples/loopback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,16 @@ fn loopback_standard<'a>(
}
}

#[rustversion::before(1.63)]
fn loopback_split<'a>(
_port: &mut Box<dyn SerialPort>,
_read_stats: &mut Stats<'a>,
_write_stats: &mut Stats<'a>,
) {
unimplemented!("requires Rust 1.63 or later");
}

#[rustversion::since(1.63)]
fn loopback_split<'a>(
port: &mut Box<dyn SerialPort>,
read_stats: &mut Stats<'a>,
Expand Down

0 comments on commit c320919

Please sign in to comment.