doc: fix example for start command
This commit is contained in:
parent
cf6c3d0a4c
commit
6ce489568b
3 changed files with 16 additions and 4 deletions
|
@ -189,10 +189,21 @@ impl SonicChannel {
|
||||||
/// I think we shouldn't separate commands connect and start because we haven't
|
/// 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. 🤔
|
/// possibility to change channel in sonic server, if we already chosen one of them. 🤔
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust,no_run
|
||||||
/// use sonic_channel::*;
|
/// 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<A, S>(mode: ChannelMode, addr: A, password: S) -> Result<Self>
|
pub fn connect_with_start<A, S>(mode: ChannelMode, addr: A, password: S) -> Result<Self>
|
||||||
where
|
where
|
||||||
|
|
|
@ -13,6 +13,7 @@ const RE_START_RECEIVED_MESSAGE: &str = r"(?x)
|
||||||
buffer\((?P<buffer_size>\d+)\)
|
buffer\((?P<buffer_size>\d+)\)
|
||||||
";
|
";
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct StartCommand {
|
pub struct StartCommand {
|
||||||
pub mode: ChannelMode,
|
pub mode: ChannelMode,
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
//!
|
//!
|
||||||
//! Note: This example requires enabling the `search` feature, enabled by default.
|
//! Note: This example requires enabling the `search` feature, enabled by default.
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```rust,no_run
|
||||||
//! use sonic_channel::*;
|
//! use sonic_channel::*;
|
||||||
//!
|
//!
|
||||||
//! fn main() -> result::Result<()> {
|
//! fn main() -> result::Result<()> {
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
//!
|
//!
|
||||||
//! Note: This example requires enabling the `ingest` feature.
|
//! Note: This example requires enabling the `ingest` feature.
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```rust,no_run
|
||||||
//! use sonic_channel::*;
|
//! use sonic_channel::*;
|
||||||
//!
|
//!
|
||||||
//! fn main() -> result::Result<()> {
|
//! fn main() -> result::Result<()> {
|
||||||
|
|
Loading…
Reference in a new issue