diff --git a/src/get.rs b/src/get.rs index f392192..d58907a 100644 --- a/src/get.rs +++ b/src/get.rs @@ -45,7 +45,11 @@ where }) } -pub fn read, K: AsRef>(cache: P, key: K) -> Result, Error> { +pub fn read(cache: P, key: K) -> Result, Error> +where + P: AsRef, + K: AsRef, +{ if let Some(entry) = index::find(cache.as_ref(), key.as_ref())? { read_hash(cache, &entry.integrity) } else { @@ -53,11 +57,19 @@ pub fn read, K: AsRef>(cache: P, key: K) -> Result, } } -pub fn read_hash>(cache: P, sri: &Integrity) -> Result, Error> { +pub fn read_hash

(cache: P, sri: &Integrity) -> Result, Error> +where + P: AsRef +{ Ok(read::read(cache.as_ref(), sri)?) } -pub fn copy, K: AsRef>(cache: P, key: K, to: P) -> Result { +pub fn copy(cache: P, key: K, to: Q) -> Result +where + P: AsRef, + K: AsRef, + Q: AsRef, +{ if let Some(entry) = index::find(cache.as_ref(), key.as_ref())? { copy_hash(cache, &entry.integrity, to) } else { @@ -65,11 +77,19 @@ pub fn copy, K: AsRef>(cache: P, key: K, to: P) -> Result>(cache: P, sri: &Integrity, to: P) -> Result { +pub fn copy_hash(cache: P, sri: &Integrity, to: Q) -> Result +where + P: AsRef, + Q: AsRef, +{ read::copy(cache.as_ref(), sri, to.as_ref()) } -pub fn info, K: AsRef>(cache: P, key: K) -> Result, Error> { +pub fn info(cache: P, key: K) -> Result, Error> +where + P: AsRef, + K: AsRef, +{ index::find(cache.as_ref(), key.as_ref()) }