diff --git a/src/commands/server_commands.rs b/src/commands/server_commands.rs index 1d205e5..82280b4 100644 --- a/src/commands/server_commands.rs +++ b/src/commands/server_commands.rs @@ -663,6 +663,37 @@ pub trait ServerCommands<'a> { prepare_command(self, cmd("LATENCY").arg("GRAPH").arg(event)) } + /// The command returns a helpful text describing the different LATENCY subcommands. + /// + /// # Return + /// An array of strings. + /// + /// # Example + /// ``` + /// # use rustis::{ + /// # client::Client, + /// # commands::ServerCommands, + /// # Result, + /// # }; + /// # + /// # #[cfg_attr(feature = "tokio-runtime", tokio::main)] + /// # #[cfg_attr(feature = "async-std-runtime", async_std::main)] + /// # async fn main() -> Result<()> { + /// # let client = Client::connect("127.0.0.1:6379").await?; + /// let result: Vec = client.latency_help().await?; + /// assert!(result.iter().any(|e| e == "HELP")); + /// # Ok(()) + /// # } + /// ``` + /// # See Also + /// [](https://redis.io/commands/latency-help/) + fn latency_help(self) -> PreparedCommand<'a, Self, Vec> + where + Self: Sized, + { + prepare_command(self, cmd("LATENCY").arg("HELP")) + } + /// This command reports a cumulative distribution of latencies /// in the format of a histogram for each of the specified command names. /// diff --git a/src/tests/server_commands.rs b/src/tests/server_commands.rs index 87f06dc..39ba6c4 100644 --- a/src/tests/server_commands.rs +++ b/src/tests/server_commands.rs @@ -697,6 +697,18 @@ async fn latency_graph() -> Result<()> { Ok(()) } +#[cfg_attr(feature = "tokio-runtime", tokio::test)] +#[cfg_attr(feature = "async-std-runtime", async_std::test)] +#[serial] +async fn latency_help() -> Result<()> { + let client = get_test_client().await?; + + let result: Vec = client.latency_help().await?; + assert!(result.iter().any(|e| e == "HELP")); + + Ok(()) +} + #[cfg_attr(feature = "tokio-runtime", tokio::test)] #[cfg_attr(feature = "async-std-runtime", async_std::test)] #[serial]