From 649398512f339933605ed70cade3ca16962a6b26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Sun, 20 Oct 2019 23:08:26 -0400 Subject: [PATCH] feat(rm): Accept AsRef for keys --- src/rm.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/rm.rs b/src/rm.rs index 283d5a5..3b435b6 100644 --- a/src/rm.rs +++ b/src/rm.rs @@ -38,8 +38,12 @@ use crate::index; /// # Ok(()) /// # } /// ``` -pub async fn entry>(cache: P, key: &str) -> Result<()> { - Ok(index::delete_async(cache.as_ref(), &key).await?) +pub async fn entry(cache: P, key: K) -> Result<()> +where + P: AsRef, + K: AsRef, +{ + index::delete_async(cache.as_ref(), key.as_ref()).await } /// Removes an individual content entry. Any index entries pointing to this @@ -131,8 +135,12 @@ pub async fn all>(cache: P) -> Result<()> { /// # Ok(()) /// # } /// ``` -pub fn entry_sync>(cache: P, key: &str) -> Result<()> { - Ok(index::delete(cache.as_ref(), &key)?) +pub fn entry_sync(cache: P, key: K) -> Result<()> +where + P: AsRef, + K: AsRef, +{ + index::delete(cache.as_ref(), key.as_ref()) } /// Removes an individual content entry synchronously. Any index entries