diff --git a/src/put.rs b/src/put.rs
index 78a2bca..da09628 100644
--- a/src/put.rs
+++ b/src/put.rs
@@ -17,6 +17,23 @@ use crate::index;
use std::task::{Context, Poll};
/// Writes `data` to the `cache`, indexing it under `key`.
+///
+/// ## Example
+/// ```no_run
+/// # use async_std::prelude::*;
+/// # use async_std::task;
+/// # fn main() -> Result<(), cacache::Error> {
+/// # task::block_on(async {
+/// # example().await.unwrap();
+/// # });
+/// # Ok(())
+/// # }
+/// #
+/// # async fn example() -> Result<(), cacache::Error> {
+/// cacache::put::data("./my-cache", "my-key", b"hello").await?;
+/// # Ok(())
+/// # }
+/// ```
pub async fn data
(cache: P, key: K, data: D) -> Result
where
P: AsRef,
@@ -89,6 +106,15 @@ impl AsyncPut {
}
/// Writes `data` to the `cache` synchronously, indexing it under `key`.
+///
+/// ## Example
+/// ```no_run
+/// # fn main() -> Result<(), cacache::Error> {
+/// # use std::io::Read;
+/// let data = cacache::put::data_sync("./my-cache", "my-key", b"hello")?;
+/// # Ok(())
+/// # }
+/// ```
pub fn data_sync(cache: P, key: K, data: D) -> Result
where
P: AsRef,
@@ -123,7 +149,7 @@ impl PutOpts {
Default::default()
}
- /// Opens the file handle for writing, returning a Put instance.
+ /// Opens the file handle for writing, returning an AsyncPut instance.
pub async fn open(self, cache: P, key: K) -> Result
where
P: AsRef,
@@ -142,7 +168,7 @@ impl PutOpts {
})
}
- /// Opens the file handle for writing synchronously, returning a Put instance.
+ /// Opens the file handle for writing synchronously, returning a SyncPut instance.
pub fn open_sync(self, cache: P, key: K) -> Result
where
P: AsRef,