pub async fn new_from_async_readers<R, I>(
        hash_algo: HashAlgorithm,
        content: I,
    ) -> IOResult<Vector<GitOid>>
    where
        R: AsyncReadExt + std::marker::Unpin,
        I: IntoIterator<Item = Source<R>>,
    {
        let digest = hash_algo.create_digest();
        let mut future_vec = Vec::new();

        // go get the futures for each hash operation
        for reader in content {
            let expected_length = reader.len();
            future_vec.push(GitOid::generate_git_oid_from_async_buffer(
                digest.clone(),
                reader,
                expected_length,
            ));
        }

        // create the return vector
        let mut ret = Vector::new();

        // go through each future and await the response
        // the cool thing is that this will block on any given future
        // but other futures may become satisfied so the look effectively
        // blocks on the longest-to-satisfy future
        for res in futures::future::join_all(future_vec).await {
            let (len, bytes) = res?;
            ret.push_back(GitOid {
                hash_algorithm: hash_algo,
                len: len,
                value: bytes,
            });
        }

        Ok(ret)
    }
/// generate a bunch of `GitOid`s from a bunch of async
/// readers for a given algorithm
generate a bunch of `GitOid`s from a bunch of async
readers for a given algorithm
generate a bunch of ` GitOid ` s from a bunch of async readers for a given algorithm
pub async fn new_from_async_readers<R, I>(
        hash_algo: HashAlgorithm,
        content: I,
    ) -> IOResult<Vector<GitOid>>
    where
        R: AsyncReadExt + std::marker::Unpin,
        I: IntoIterator<Item = Source<R>>,
    {
        let digest = hash_algo.create_digest();
        let mut future_vec = Vec::new();
        // go get the futures for each hash operation
        for reader in content {
            let expected_length = reader.len();
            future_vec.push(GitOid::generate_git_oid_from_async_buffer(
                digest.clone(),
                reader,
                expected_length,
            ));
        }
        // create the return vector
        let mut ret = Vector::new();
        // go through each future and await the response
        // the cool thing is that this will block on any given future
        // but other futures may become satisfied so the look effectively
        // blocks on the longest-to-satisfy future
        for res in futures::future::join_all(future_vec).await {
            let (len, bytes) = res?;
            ret.push_back(GitOid {
                hash_algorithm: hash_algo,
                len: len,
                value: bytes,
            });
        }
        Ok(ret)
    }
pub async fn new_from_async_readers < R , I > ( hash_algo : HashAlgorithm , content : I , ) -> IOResult < Vector < GitOid > > where R : AsyncReadExt + std :: marker :: Unpin , I : IntoIterator < Item = Source < R > > , { let digest = hash_algo . create_digest ( ) ; let mut future_vec = Vec :: new ( ) ; // go get the futures for each hash operation for reader in content { let expected_length = reader . len ( ) ; future_vec . push ( GitOid :: generate_git_oid_from_async_buffer ( digest . clone ( ) , reader , expected_length , ) ) ; } // create the return vector let mut ret = Vector :: new ( ) ; // go through each future and await the response // the cool thing is that this will block on any given future // but other futures may become satisfied so the look effectively // blocks on the longest-to-satisfy future for res in futures :: future :: join_all ( future_vec ) . await { let ( len , bytes ) = res ? ; ret . push_back ( GitOid { hash_algorithm : hash_algo , len : len , value : bytes , } ) ; } Ok ( ret ) }
generate a bunch of `GitOid`s from a bunch of async
readers for a given algorithm
generate a bunch of ` GitOid ` s from a bunch of async readers for a given algorithm
hash_algo
HashAlgorithm
content
I
hash_algo
HashAlgorithm
content
I