/// Reads the entire contents of a cache file into a bytes vector, looking the
/// data up by key.
Reads the entire contents of a cache file into a bytes vector, looking the
data up by key.
Reads the entire contents of a cache file into a bytes vector looking the data up by key .
pub async fn read<P, K>(cache: P, key: K) -> Result<Vec<u8>, Error>
where
    P: AsRef<Path>,
    K: AsRef<str>,
{
    if let Some(entry) = index::find_async(cache.as_ref(), key.as_ref()).await? {
        read_hash(cache, &entry.integrity).await
    } else {
        Err(Error::NotFound)
    }
}
pub async fn read < P , K > ( cache : P , key : K ) -> Result < Vec < u8 > , Error > where P : AsRef < Path > , K : AsRef < str > , { if let Some ( entry ) = index :: find_async ( cache . as_ref ( ) , key . as_ref ( ) ) . await ? { read_hash ( cache , & entry . integrity ) . await } else { Err ( Error :: NotFound ) } }
Reads the entire contents of a cache file into a bytes vector, looking the
data up by key.
Reads the entire contents of a cache file into a bytes vector looking the data up by key .
cache
P
key
K