Skip to content

Commit

Permalink
probe(): returns Libraries instead of the hash directly
Browse files Browse the repository at this point in the history
This is an API break.
  • Loading branch information
Guillaume Desmottes authored and gdesmott committed Feb 10, 2021
1 parent 78fcb86 commit 7d1eb15
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,12 @@ pub enum Error {
}

#[derive(Debug, Default)]
struct Libraries {
/// All the system dependencies retrieved by [Config::probe].
pub struct Libraries {
libs: HashMap<String, Library>,
}

impl Libraries {
fn into_hash(self) -> HashMap<String, Library> {
self.libs
}

/// Retrieve details about a system dependency.
///
/// # Arguments
Expand Down Expand Up @@ -427,7 +424,7 @@ impl Config {
/// `[package.metadata.system-deps]` section.
///
/// The returned hash is using the the `toml` key defining the dependency as key.
pub fn probe(self) -> Result<HashMap<String, Library>, Error> {
pub fn probe(self) -> Result<Libraries, Error> {
let libraries = self.probe_full()?;
let flags = libraries.gen_flags()?;

Expand All @@ -438,7 +435,7 @@ impl Config {
println!("cargo:rustc-cfg=system_deps_have_{}", name.to_snake_case());
}

Ok(libraries.into_hash())
Ok(libraries)
}

/// Add hook so system-deps can internally build library `name` if requested by user.
Expand Down

0 comments on commit 7d1eb15

Please sign in to comment.