From 6ce489568b12e1a5d2ac9194419b1c6408278552 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Sat, 1 Aug 2020 11:04:54 +0300 Subject: [PATCH] doc: fix example for start command --- src/channel.rs | 15 +++++++++++++-- src/commands/start.rs | 1 + src/lib.rs | 4 ++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/channel.rs b/src/channel.rs index 8f77da2..669479f 100644 --- a/src/channel.rs +++ b/src/channel.rs @@ -189,10 +189,21 @@ impl SonicChannel { /// I think we shouldn't separate commands connect and start because we haven't /// possibility to change channel in sonic server, if we already chosen one of them. 🤔 /// - /// ```rust + /// ```rust,no_run /// use sonic_channel::*; /// - /// SonicChannel::connect_with_start(ChannelMode::Search, "localhost:1491", "SecretPassword"); + /// fn main() -> result::Result<()> { + /// let channel = SonicChannel::connect_with_start( + /// ChannelMode::Search, + /// "localhost:1491", + /// "SecretPassword" + /// )?; + /// + /// // Now you can use all method of Search channel. + /// let objects = channel.query("search", "default", "beef"); + /// + /// Ok(()) + /// } /// ``` pub fn connect_with_start(mode: ChannelMode, addr: A, password: S) -> Result where diff --git a/src/commands/start.rs b/src/commands/start.rs index a8337b8..cd19204 100644 --- a/src/commands/start.rs +++ b/src/commands/start.rs @@ -13,6 +13,7 @@ const RE_START_RECEIVED_MESSAGE: &str = r"(?x) buffer\((?P\d+)\) "; +#[doc(hidden)] #[derive(Debug)] pub struct StartCommand { pub mode: ChannelMode, diff --git a/src/lib.rs b/src/lib.rs index 089f1e8..c094776 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,7 +8,7 @@ //! //! Note: This example requires enabling the `search` feature, enabled by default. //! -//! ```rust +//! ```rust,no_run //! use sonic_channel::*; //! //! fn main() -> result::Result<()> { @@ -29,7 +29,7 @@ //! //! Note: This example requires enabling the `ingest` feature. //! -//! ```rust +//! ```rust,no_run //! use sonic_channel::*; //! //! fn main() -> result::Result<()> {