diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2018-02-13 23:39:43 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2018-02-19 12:14:32 +0100 |
commit | 2328c8b2b01c60395aafce04cdd60596656c2696 (patch) | |
tree | 82fcaa547ed4ebc0ea02193f61829f5a4601ca51 /lib/entry/libimagentryref | |
parent | a5eaf0439c92ab98f78e557e62dea956bed33904 (diff) |
Take AsRef<str> rather than &String
Diffstat (limited to 'lib/entry/libimagentryref')
-rw-r--r-- | lib/entry/libimagentryref/src/refstore.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/entry/libimagentryref/src/refstore.rs b/lib/entry/libimagentryref/src/refstore.rs index 69a96eb8..c428efb2 100644 --- a/lib/entry/libimagentryref/src/refstore.rs +++ b/lib/entry/libimagentryref/src/refstore.rs @@ -85,7 +85,7 @@ pub trait UniqueRefPathGenerator { /// pub trait RefStore<'a> { - fn get_ref<RPG: UniqueRefPathGenerator>(&'a self, hash: &String) -> Result<Option<FileLockEntry<'a>>, RPG::Error>; + fn get_ref<RPG: UniqueRefPathGenerator, H: AsRef<str>>(&'a self, hash: H) -> Result<Option<FileLockEntry<'a>>, RPG::Error>; fn create_ref<RPG: UniqueRefPathGenerator, A: AsRef<Path>>(&'a self, path: A) -> Result<FileLockEntry<'a>, RPG::Error>; fn retrieve_ref<RPG: UniqueRefPathGenerator, A: AsRef<Path>>(&'a self, path: A) -> Result<FileLockEntry<'a>, RPG::Error>; @@ -93,10 +93,10 @@ pub trait RefStore<'a> { impl<'a> RefStore<'a> for Store { - fn get_ref<RPG: UniqueRefPathGenerator>(&'a self, hash: &String) + fn get_ref<RPG: UniqueRefPathGenerator, H: AsRef<str>>(&'a self, hash: H) -> Result<Option<FileLockEntry<'a>>, RPG::Error> { - let sid = StoreId::new_baseless(PathBuf::from(format!("{}/{}", RPG::collection(), hash))) + let sid = StoreId::new_baseless(PathBuf::from(format!("{}/{}", RPG::collection(), hash.as_ref()))) .map_err(RE::from)?; debug!("Getting: {:?}", sid); @@ -131,7 +131,7 @@ impl<'a> RefStore<'a> for Store { fn retrieve_ref<RPG: UniqueRefPathGenerator, A: AsRef<Path>>(&'a self, path: A) -> Result<FileLockEntry<'a>, RPG::Error> { - match self.get_ref::<RPG>(&RPG::unique_hash(path.as_ref())?)? { + match self.get_ref::<RPG, String>(RPG::unique_hash(path.as_ref())?)? { Some(r) => Ok(r), None => self.create_ref::<RPG, A>(path), } |