Skip to content

Commit 8962851

Browse files
committed
packages_for_family: consistently return an error if PFN not found
1 parent a9a8cbb commit 8962851

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/repository.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ pub fn packages() -> io::Result<impl Iterator<Item = PackageFullName>> { imp::pa
3939
///
4040
/// ```rust
4141
/// let fam = appx::PackageFamilyName::new("NcsiUwpApp_8wekyb3d8bbwe");
42-
/// for pkg in appx::repository::packages_for_family(&fam).unwrap() {
43-
/// println!("{}", pkg);
42+
/// if let Ok(packages) = appx::repository::packages_for_family(&fam) {
43+
/// for pkg in packages {
44+
/// println!("{}", pkg);
45+
/// }
4446
/// }
4547
/// ```
4648
pub fn packages_for_family(family: &PackageFamilyName) -> io::Result<impl Iterator<Item = PackageFullName>> { imp::packages_for_family(family) }
@@ -85,7 +87,7 @@ pub fn add_appx_package(path: impl AsRef<Path>) -> io::Result<()> {
8587
use super::*;
8688
pub(super) fn families() -> io::Result<impl Iterator<Item = PackageFamilyName>> { Ok(None.into_iter()) }
8789
pub(super) fn packages() -> io::Result<impl Iterator<Item = PackageFullName >> { Ok(None.into_iter()) }
88-
pub(super) fn packages_for_family(_family: &PackageFamilyName) -> io::Result<impl Iterator<Item = PackageFullName>> { Ok(None.into_iter()) }
90+
pub(super) fn packages_for_family(_family: &PackageFamilyName) -> io::Result<std::vec::IntoIter<PackageFullName>> { Err(io::Error::from(io::ErrorKind::NotFound)) }
8991
}
9092

9193

0 commit comments

Comments
 (0)