fix (backend-rs): fix doc comments

This commit is contained in:
naskya 2024-08-02 00:18:03 +09:00
parent 7de36a2d43
commit 2b31b55cf3
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C

View file

@ -110,12 +110,13 @@ pub async fn set<V: for<'a> Deserialize<'a> + Serialize>(
/// ///
/// ``` /// ```
/// # use backend_rs::cache; /// # use backend_rs::cache;
/// use chrono::Duration;
/// # async fn f() -> Result<(), Box<dyn std::error::Error>> { /// # async fn f() -> Result<(), Box<dyn std::error::Error>> {
/// let key = "banana"; /// let key = "banana";
/// let data = "I want to cache this string".to_owned(); /// let data = "I want to cache this string".to_owned();
/// ///
/// // set cache /// // set cache
/// cache::set(key, &data, 10).await?; /// cache::set(key, &data, Duration::seconds(10)).await?;
/// ///
/// // get cache /// // get cache
/// let cached_data = cache::get::<String>(key).await?; /// let cached_data = cache::get::<String>(key).await?;
@ -149,12 +150,13 @@ pub async fn get<V: for<'a> Deserialize<'a> + Serialize>(key: &str) -> Result<Op
/// ///
/// ``` /// ```
/// # use backend_rs::cache; /// # use backend_rs::cache;
/// use chrono::Duration;
/// # async fn f() -> Result<(), Box<dyn std::error::Error>> { /// # async fn f() -> Result<(), Box<dyn std::error::Error>> {
/// let key = "chocolate"; /// let key = "chocolate";
/// let value = "I want to cache this string".to_owned(); /// let value = "I want to cache this string".to_owned();
/// ///
/// // set cache /// // set cache
/// cache::set(key, &value, 10).await?; /// cache::set(key, &value, Duration::seconds(10)).await?;
/// ///
/// // delete the cache /// // delete the cache
/// cache::delete("foo").await?; /// cache::delete("foo").await?;