Struct stitch::StitchClient [] [src]

pub struct StitchClient { /* fields omitted */ }

Holds an inner representation of a stitch client. This type can be created on a separate thread and sent messages over a channel, or can be safely cloned many times on a single thread.

Methods

impl StitchClient
[src]

[src]

Create a new stitch client.

[src]

Returns the client_id.

[src]

Upserts a single Message, as a future.

[src]

Returns the current status of the stitch api, as a future.

[src]

Validates a batch of Messages, as a future.

[src]

Upserts a batch of Messages, as a future.

[src]

Returns a future that represents a buffered stream, represented by a futures::sync::mpsc::Receiver. The stream is chunked and each batch is sent to stitch. Failures are logged and dropped.

Examples

This example is not tested
extern crate futures;
extern crate stitch;
extern crate tokio_core;

use std::thread;

use futures::sync::mpsc::channel;
use stitch::StitchClient;
use tokio_core::reactor::Core;

fn main() {
    let (mut tx, mut rx) = channel(10);

    let t = thread::spawn(move || {
        let mut core = Core::new().unwrap();
        let client = StitchClient::new(&core.handle(), 1, "auth_token_1").unwrap();

        core.run(client.buffer_channel(20, rx)).unwrap();
    });
}
This example is not tested
extern crate futures;
extern crate stitch;
extern crate tokio_core;

use futures::sync::mpsc::channel;
use stitch::StitchClient;
use tokio_core::reactor::Core;

fn main() {
    let mut core = Core::new().unwrap();
    let client = StitchClient::new(&core.handle(), 1, "auth_token_1").unwrap();
    let (mut tx, mut rx) = channel(10);

    core.run(client.buffer_channel(20, rx)).unwrap();
}

Trait Implementations

impl Clone for StitchClient
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl !Send for StitchClient

impl !Sync for StitchClient