From 4875bffb4c7995b0d6a1682c095ee9e1814d4bbf Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Sat, 1 Aug 2020 23:23:56 +0300 Subject: [PATCH] doc: add examples for quit and ping --- src/channel.rs | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/src/channel.rs b/src/channel.rs index 669479f..93d95b0 100644 --- a/src/channel.rs +++ b/src/channel.rs @@ -215,12 +215,41 @@ impl SonicChannel { Ok(channel) } - // TODO: add examples for commands. init_commands! { - #[doc="Stop connection."] + #[doc=r#" + Stop connection. + + ```rust,no_run + # use sonic_channel::*; + # fn main() -> result::Result<()> { + let channel = SonicChannel::connect_with_start( + ChannelMode::Search, + "localhost:1491", + "SecretPassword" + )?; + + channel.quit()?; + # Ok(()) + # } + "#] use QuitCommand for fn quit(); - #[doc="Ping server."] + #[doc=r#" + Ping server. + + ```rust,no_run + # use sonic_channel::*; + # fn main() -> result::Result<()> { + let channel = SonicChannel::connect_with_start( + ChannelMode::Search, + "localhost:1491", + "SecretPassword" + )?; + + channel.ping()?; + # Ok(()) + # } + "#] use PingCommand for fn ping(); }