/// Assert the iterator returns all the expected packages.
Assert the iterator returns all the expected packages.
Assert the iterator returns all the expected packages .
async fn assert_base_packages_match(
    pkg_iterator: PackageIndexIteratorProxy,
    static_packages: &[&Package],
) {
    let mut expected_pkg_url =
        static_packages.into_iter().map(|pkg| format!("fuchsia-pkg://fuchsia.com/{}", pkg.name()));
    let mut expected_merkle =
        static_packages.into_iter().map(|pkg| BlobId::from(pkg.meta_far_merkle_root().clone()));
    let mut chunk = pkg_iterator.next().await.unwrap();
    let max_chunk_size: usize = 32;
    while chunk.len() != 0 {
        assert!(chunk.len() <= max_chunk_size);
        for entry in chunk {
            assert_eq!(entry.package_url.url, expected_pkg_url.next().unwrap());
            assert_eq!(BlobId::from(entry.meta_far_blob_id), expected_merkle.next().unwrap());
        }
        chunk = pkg_iterator.next().await.unwrap();
    }
}
async fn assert_base_packages_match ( pkg_iterator : PackageIndexIteratorProxy , static_packages : & [ & Package ] , ) { let mut expected_pkg_url = static_packages . into_iter ( ) . map ( | pkg | format ! ( " " pkg name ( ) ) ) ; let mut expected_merkle = static_packages . into_iter ( ) . map ( | pkg | BlobId :: from ( pkg . meta_far_merkle_root ( ) . clone ( ) ) ) ; let mut chunk = pkg_iterator . next ( ) . await . unwrap ( ) ; let max_chunk_size : usize = 32 ; while chunk . len ( ) != 0 { assert ! ( chunk len ( ) max_chunk_size ) ; for entry in chunk { assert_eq ! ( entry package_url url expected_pkg_url next ( ) unwrap ( ) ) ; assert_eq ! ( BlobId from ( entry meta_far_blob_id ) expected_merkle next ( ) unwrap ( ) ) ; } chunk = pkg_iterator . next ( ) . await . unwrap ( ) ; } }
Assert the iterator returns all the expected packages.
Assert the iterator returns all the expected packages .
pkg_iterator
PackageIndexIteratorProxy
static_packages
&[&Package]