Crate couchbase [] [src]

This crate represents the official, yet under heavy development, Rust SDK for Couchbase.

It is based on the couchbase_sys-crate, which in turn consists of Rust bindings to the libcouchbase c-library.


Reading and writing a Document is simple:

extern crate couchbase;
extern crate futures;

use couchbase::{Document, Cluster};
use futures::Future;

/// A very simple example which connects to the `default` bucket and writes and loads
/// a document.
fn main() {
    // Initialize the Cluster
    let cluster = Cluster::new("localhost").expect("Could not initialize Cluster");

    // Open the travel-sample bucket
    let bucket = cluster.open_bucket("default", "").expect("Could not open Bucket");

    // Create a document and store it in the bucket
    let document = Document::from_str("hello", "{\"world\":true}");
    println!("Wrote Document {:?}",
                 .expect("Upsert failed!"));

    // Load the previously written document and print it out
    println!("Found Document {:?}",
             bucket.get("hello").wait().expect("Could not load Document"));

For now, more examples can be found under examples. Note that for all the serde-based examples you need to at least have Rust 1.15.0 installed.


pub use document::Document;
pub use bucket::Bucket;
pub use cluster::Cluster;
pub use sync::CouchbaseFuture;
pub use sync::CouchbaseStream;
pub use error::CouchbaseError;
pub use query::n1ql::N1qlMeta;
pub use query::n1ql::N1qlResult;
pub use query::n1ql::N1qlRow;
pub use query::views::ViewMeta;
pub use query::views::ViewResult;
pub use query::views::ViewRow;
pub use query::views::ViewQuery;



Bucket-level operations and API.


Cluster-level operations and API.


Everything regarding Documents and their usage.


Contains error types and handling routines.


Contains query handling routines (n1ql, views, fts,...)


Synchronization and Future/Stream abstractions.