mirror of https://github.com/zkat/cacache-rs.git
feat(rm): Accept AsRef<str> for keys
This commit is contained in:
parent
fbeb6ec0ff
commit
649398512f
16
src/rm.rs
16
src/rm.rs
|
|
@ -38,8 +38,12 @@ use crate::index;
|
|||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
pub async fn entry<P: AsRef<Path>>(cache: P, key: &str) -> Result<()> {
|
||||
Ok(index::delete_async(cache.as_ref(), &key).await?)
|
||||
pub async fn entry<P, K>(cache: P, key: K) -> Result<()>
|
||||
where
|
||||
P: AsRef<Path>,
|
||||
K: AsRef<str>,
|
||||
{
|
||||
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<P: AsRef<Path>>(cache: P) -> Result<()> {
|
|||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
pub fn entry_sync<P: AsRef<Path>>(cache: P, key: &str) -> Result<()> {
|
||||
Ok(index::delete(cache.as_ref(), &key)?)
|
||||
pub fn entry_sync<P, K>(cache: P, key: K) -> Result<()>
|
||||
where
|
||||
P: AsRef<Path>,
|
||||
K: AsRef<str>,
|
||||
{
|
||||
index::delete(cache.as_ref(), key.as_ref())
|
||||
}
|
||||
|
||||
/// Removes an individual content entry synchronously. Any index entries
|
||||
|
|
|
|||
Loading…
Reference in New Issue