Skip to content

Commit

Permalink
add pubsub help command (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtemIsmagilov authored Feb 27, 2025
1 parent dbed980 commit 084b3c4
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/commands/pub_sub_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,39 @@ pub trait PubSubCommands<'a> {
prepare_command(self, cmd("PUBSUB").arg("CHANNELS").arg(options))
}

/// The command returns a helpful text describing the different PUBSUB subcommands.
///
/// # Return
/// An array of strings.
///
/// # Example
/// ```
/// # use rustis::{
/// # client::Client,
/// # commands::PubSubCommands,
/// # 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<String> = client.pub_sub_help().await?;
/// assert!(result.iter().any(|e| e == "HELP"));
/// # Ok(())
/// # }
/// ```
///
/// # See Also
/// [<https://redis.io/commands/pubsub-help/>](https://redis.io/commands/pubsub-help/)
#[must_use]
fn pub_sub_help(self) -> PreparedCommand<'a, Self, Vec<String>>
where
Self: Sized,
{
prepare_command(self, cmd("PUBSUB").arg("HELP"))
}

/// Returns the number of unique patterns that are subscribed to by clients
/// (that are performed using the PSUBSCRIBE command).
///
Expand Down

0 comments on commit 084b3c4

Please sign in to comment.