Skip to content

Commit

Permalink
Build version-dependent examples only when supported
Browse files Browse the repository at this point in the history
This reduces the noise in CI when checking MSRV.
  • Loading branch information
sirhcel committed May 12, 2024
1 parent cb88008 commit b71fc0e
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 b71fc0e

Please sign in to comment.