From 23c8636129026d9c9f2ba071db67db9cfafc8b77 Mon Sep 17 00:00:00 2001 From: naskya <m@naskya.net> Date: Sat, 1 Jun 2024 02:23:58 +0900 Subject: [PATCH] chore (backend-rs, macro-rs): fix comment style --- packages/backend-rs/src/database/cache.rs | 26 +++++++++++------------ packages/macro-rs/src/lib.rs | 12 +++++------ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/packages/backend-rs/src/database/cache.rs b/packages/backend-rs/src/database/cache.rs index bf675efa38..77077b8c50 100644 --- a/packages/backend-rs/src/database/cache.rs +++ b/packages/backend-rs/src/database/cache.rs @@ -50,9 +50,9 @@ fn wildcard(category: Category) -> String { /// /// # Arguments /// -/// - `key` : key (prefixed automatically) -/// - `value` : (de)serializable value -/// - `expire_seconds` : TTL +/// * `key` : key (prefixed automatically) +/// * `value` : (de)serializable value +/// * `expire_seconds` : TTL /// /// # Example /// @@ -96,7 +96,7 @@ pub async fn set<V: for<'a> Deserialize<'a> + Serialize>( /// /// # Argument /// -/// - `key` : key (will be prefixed automatically) +/// * `key` : key (will be prefixed automatically) /// /// # Example /// @@ -135,9 +135,9 @@ pub async fn get<V: for<'a> Deserialize<'a> + Serialize>(key: &str) -> Result<Op /// /// # Argument /// -/// - `key` : key (prefixed automatically) +/// * `key` : key (prefixed automatically) /// -/// ## Example +/// # Example /// /// ``` /// # use backend_rs::database::cache; @@ -169,10 +169,10 @@ pub async fn delete(key: &str) -> Result<(), Error> { /// /// # Arguments /// -/// - `category` : one of [Category] -/// - `key` : key (prefixed automatically) -/// - `value` : (de)serializable value -/// - `expire_seconds` : TTL +/// * `category` : one of [Category] +/// * `key` : key (prefixed automatically) +/// * `value` : (de)serializable value +/// * `expire_seconds` : TTL pub async fn set_one<V: for<'a> Deserialize<'a> + Serialize>( category: Category, key: &str, @@ -188,8 +188,8 @@ pub async fn set_one<V: for<'a> Deserialize<'a> + Serialize>( /// /// # Arguments /// -/// - `category` : one of [Category] -/// - `key` : key (prefixed automatically) +/// * `category` : one of [Category] +/// * `key` : key (prefixed automatically) pub async fn get_one<V: for<'a> Deserialize<'a> + Serialize>( category: Category, key: &str, @@ -213,7 +213,7 @@ pub async fn delete_one(category: Category, key: &str) -> Result<(), Error> { /// /// # Argument /// -/// - `category` : one of [Category] +/// * `category` : one of [Category] pub async fn delete_all(category: Category) -> Result<(), Error> { let mut redis = redis_conn().await?; let keys: Vec<Vec<u8>> = redis.keys(wildcard(category)).await?; diff --git a/packages/macro-rs/src/lib.rs b/packages/macro-rs/src/lib.rs index d723868f83..943dd56cd1 100644 --- a/packages/macro-rs/src/lib.rs +++ b/packages/macro-rs/src/lib.rs @@ -25,7 +25,7 @@ pub fn read_version_from_package_json(_item: proc_macro::TokenStream) -> proc_ma quote! { #version }.into() } -/// Export this function, struct, enum, const, etc. to TypeScript. +/// Export a function, struct, enum, const, etc. to TypeScript. /// /// This is a wrapper of [macro@napi] that expands to /// ```no_run @@ -48,7 +48,7 @@ pub fn export( .into() } -/// Export this function, struct, enum, const, etc. to TypeScript +/// Export a function, struct, enum, const, etc. to TypeScript /// and make it unable to use in Rust. /// /// This is a wrapper of [macro@napi] that expands to @@ -84,13 +84,13 @@ pub fn ts_export( /// - `js_name` to the camelCase version of the original function name (for functions) /// /// The types of the function arguments is converted with following rules: -/// - `&str` and `&mut str` are converted to `String` -/// - `&[T]` and `&mut [T]` are converted to `Vec<T>` +/// - `&str` and `&mut str` are converted to [`String`] +/// - `&[T]` and `&mut [T]` are converted to [`Vec<T>`] /// - `&T` and `&mut T` are converted to `T` /// - Other `T` remains `T` /// -/// In addition, return type `Result<T>` and `Result<T, E>` are converted to `napi::Result<T>`. -/// Note that `E` must implement `std::string::ToString` trait. +/// In addition, return type [`Result<T>`] and [`Result<T, E>`] are converted to [`napi::Result<T>`](https://docs.rs/napi/latest/napi/type.Result.html). +/// Note that `E` must implement [`std::string::ToString`] trait. /// /// # Examples /// ## Applying the macro to a struct