doc: fix examples in readme

This commit is contained in:
Dmitriy Pleshevskiy 2020-07-26 21:56:30 +03:00
parent acb8c1551b
commit e3b5f90893

View file

@ -31,8 +31,8 @@ use sonic_channel::*;
fn main() -> result::Result<()> { fn main() -> result::Result<()> {
let channel = SonicChannel::connect_with_start( let channel = SonicChannel::connect_with_start(
"localhost:1491",
ChannelMode::Search, ChannelMode::Search,
"localhost:1491",
"SecretPassword", "SecretPassword",
)?; )?;
@ -50,14 +50,14 @@ use sonic_channel::*;
fn main() -> result::Result<()> { fn main() -> result::Result<()> {
let mut channel = SonicChannel::connect_with_start( let mut channel = SonicChannel::connect_with_start(
ChannelMode::Ingest,
"localhost:1491", "localhost:1491",
ChannelMode::Ingest,
"SecretPassword", "SecretPassword",
)?; )?;
let pushed = channel.push("collection", "bucket", "user:1", "my best recipe")?; let pushed = channel.push("collection", "bucket", "object:1", "my best recipe")?;
// or // or
// let pushed = channel.push_with_locale("collection", "bucket", "user:1", "Мой лучший рецепт", Some("rus"))?; // let pushed = channel.push_with_locale("collection", "bucket", "object:1", "Мой лучший рецепт", "rus")?;
dbg!(pushed); dbg!(pushed);
Ok(()) Ok(())
@ -74,4 +74,3 @@ fn main() -> result::Result<()> {
[sonic]: https://github.com/valeriansaliou/sonic [sonic]: https://github.com/valeriansaliou/sonic
[documentation]: https://docs.rs/sonic-channel