doc: add examples for quit and ping
This commit is contained in:
parent
2cd2d51ed1
commit
4875bffb4c
1 changed files with 32 additions and 3 deletions
|
@ -215,12 +215,41 @@ impl SonicChannel {
|
||||||
Ok(channel)
|
Ok(channel)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: add examples for commands.
|
|
||||||
init_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();
|
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();
|
use PingCommand for fn ping();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue