[][src]Crate sonic_channel

Sonic Channel

Rust client for sonic search backend.

Example usage

Search channel

use sonic_channel::*;
 
fn main() -> result::Result<()> {
    let channel = SonicChannel::connect_with_start(
        ChannelMode::Search,
        "localhost:1491",
        "SecretPassword",
    )?;
 
    let objects = channel.query("collection", "bucket", "recipe")?;
    dbg!(objects);
 
    Ok(())
}

Ingest channel

use sonic_channel::*;
 
fn main() -> result::Result<()> {
    let mut channel = SonicChannel::connect_with_start(
        ChannelMode::Ingest,
        "localhost:1491",
        "SecretPassword",
    )?;
 
    let pushed = channel.push("collection", "bucket", "object:1", "my best recipe")?;
    // or
    // let pushed = channel.push_with_locale("collection", "bucket", "object:1", "Мой лучший рецепт", "rus")?;
    dbg!(pushed);
 
    Ok(())
}

Modules

result

Contains sonic channel error type and custom Result type for easy configure your functions.

Structs

FlushCommand
PingCommand
PushCommand
QueryCommand
QuitCommand
SonicChannel

Root and Heart of this library.

StartCommand
SuggestCommand

Enums

ChannelMode

Channel modes supported by sonic search backend.

Traits

StreamCommand