diff --git a/src/get.rs b/src/get.rs index a5a2fc2..c5547a8 100644 --- a/src/get.rs +++ b/src/get.rs @@ -7,7 +7,7 @@ use crate::content::read; use crate::errors::Error; use crate::index::{self, Entry}; -pub fn read(cache: &Path, key: String) -> Result, Error> { +pub fn read(cache: &Path, key: &str) -> Result, Error> { if let Some(entry) = index::find(&cache, &key)? { read_hash(cache, &entry.integrity) } else { @@ -19,7 +19,7 @@ pub fn read_hash(cache: &Path, sri: &Integrity) -> Result, Error> { Ok(read::read(cache, sri)?) } -pub fn copy(cache: &Path, key: String, to: &Path) -> Result { +pub fn copy(cache: &Path, key: &str, to: &Path) -> Result { if let Some(entry) = index::find(&cache, &key)? { copy_hash(cache, &entry.integrity, to) } else { @@ -31,7 +31,7 @@ pub fn copy_hash(cache: &Path, sri: &Integrity, to: &Path) -> Result Ok(read::copy(cache, sri, to)?) } -pub fn info(cache: &Path, key: String) -> Result, Error> { +pub fn info(cache: &Path, key: &str) -> Result, Error> { index::find(cache, &key) } diff --git a/src/put.rs b/src/put.rs index 3574b01..049c341 100644 --- a/src/put.rs +++ b/src/put.rs @@ -9,7 +9,7 @@ use crate::content::write; use crate::index; use crate::errors::Error; -pub fn data(cache: &Path, key: String, data: Vec) -> Result { +pub fn data(cache: &Path, key: &str, data: Vec) -> Result { let sri = write::write(&cache, &data)?; Writer::new(cache, &key).integrity(sri).commit(data) }