Skip to content

Commit 06d28f0

Browse files
committed
Update examples to recommend using a minimum version requirement.
Most packages linking to a C library will have some minimum version requirement for that library, depending on the symbols they use. Recommend using `atleast_version` to set a minimum version.
1 parent 3ceb6e7 commit 06d28f0

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,21 @@ A simple library meant to be used as a build dependency with Cargo packages in
88
order to use the system `pkg-config` tool (if available) to determine where a
99
library is located.
1010

11+
# Example
12+
13+
Find the system library named `foo`, with minimum version 1.2.3:
14+
15+
```rust
16+
extern crate pkg_config;
17+
18+
fn main() {
19+
pkg_config::Config::new().atleast_version("1.2.3").probe("foo").unwrap();
20+
}
21+
```
22+
23+
Find the system library named `foo`, with no version requirement (not
24+
recommended):
25+
1126
```rust
1227
extern crate pkg_config;
1328

src/lib.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,18 @@
3030
//!
3131
//! # Example
3232
//!
33-
//! Find the system library named `foo`.
33+
//! Find the system library named `foo`, with minimum version 1.2.3:
34+
//!
35+
//! ```no_run
36+
//! extern crate pkg_config;
37+
//!
38+
//! fn main() {
39+
//! pkg_config::Config::new().atleast_version("1.2.3").probe("foo").unwrap();
40+
//! }
41+
//! ```
42+
//!
43+
//! Find the system library named `foo`, with no version requirement (not
44+
//! recommended):
3445
//!
3546
//! ```no_run
3647
//! extern crate pkg_config;
@@ -46,7 +57,7 @@
4657
//! extern crate pkg_config;
4758
//!
4859
//! fn main() {
49-
//! pkg_config::Config::new().statik(true).probe("foo").unwrap();
60+
//! pkg_config::Config::new().atleast_version("1.2.3").statik(true).probe("foo").unwrap();
5061
//! }
5162
//! ```
5263

0 commit comments

Comments
 (0)