1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
use super::*; /// Lookup helpers on `WorkspaceMetadata`. impl WorkspaceMetadata { /// Finds a discovered package by its Cargo package name. /// /// # Arguments /// /// - `&str` - Cargo package name. /// /// # Returns /// /// - `Option<&WorkspacePackageInfo>` - Matching package metadata if present. #[must_use] pub fn find_package(&self, name: &str) -> Option<&WorkspacePackageInfo> { self.get_packages() .iter() .find(|pkg: &&WorkspacePackageInfo| pkg.get_name() == name) } /// Returns the first discovered package declaring a `cdylib` library target. /// /// # Returns /// /// - `Option<&WorkspacePackageInfo>` - Matching `cdylib` package if present. #[must_use] pub fn first_cdylib_package(&self) -> Option<&WorkspacePackageInfo> { self.get_packages() .iter() .find(|pkg: &&WorkspacePackageInfo| pkg.get_has_cdylib()) } }