dittolive-ditto 4.5.3

Ditto is a peer to peer cross-platform database that allows mobile, web, IoT and server apps to sync with or without an internet connection.
Documentation
#![warn(rust_2018_idioms)]
#![allow(clippy::all)]
#![warn(clippy::correctness)]
#![cfg_attr(not(test), warn(clippy::perf))]
#![cfg_attr(
    doc,
    warn(
        rustdoc::bare_urls,
        rustdoc::broken_intra_doc_links,
        rustdoc::invalid_codeblock_attributes,
        rustdoc::invalid_rust_codeblocks,
    )
)]
//! # What is `Ditto`?
//!
//! `Ditto` is a cross-platform peer-to-peer database that allows apps
//! to sync with and even without internet connectivity.
//!
//! Install Ditto into your application, then use the APIs to read and write data
//! into its storage system, and it will then automatically sync any changes to other devices.
//!
//! Unlike other synchronization solutions, `Ditto` is designed for "peer-to-peer" synchronization
//! where it can directly communicate with other devices even without an Internet connection.
//!
//! In addition, `Ditto` automatically manages the complexity of using multiple network transports,
//! like Bluetooth, P2P Wi-Fi, and Local Area Network,
//! to find and connect to other devices and then synchronize any changes.
//!
//! # How to `Ditto`
//!
//! First, you need to create a Ditto instance using the `DittoBuilder` :
//! ```rust,no_run
//! # use std::sync::Arc;
//! use dittolive_ditto::prelude::*;
//! // 👇 See <https://docs.ditto.live/onboarding> for instructions on obtaining your app ID and
//! //    playground token.
//! let app_id = AppId::from_env("YOUR_APP_ID_VAR").unwrap();
//! let shared_token = "YOUR-PLAYGROUND-TOKEN-HERE".to_string();
//! let cloud_sync = true;
//! let custom_auth_url = None;
//! let ditto = Ditto::builder()
//!     .with_root(Arc::new(
//!         // 👇 folder where Ditto will keep its persistent data
//!         PersistentRoot::from_current_exe().expect("Invalid Ditto Root"),
//!     ))
//!     // 👇 this Identity is used to start developing features using Ditto
//!     .with_identity(|ditto_root| {
//!         identity::OnlinePlayground::new(
//!             ditto_root,
//!             app_id,
//!             shared_token,
//!             cloud_sync,
//!             custom_auth_url,
//!         )
//!     })
//!     .unwrap()
//!     .build()
//!     .unwrap();
//! ```
//! Then, create a [`Collection`](crate::store::collection::Collection) in the
//! [`Store`](crate::store::Store).
//! ```
//! # use dittolive_ditto::prelude::Ditto;
//! # fn doc_store(ditto:Ditto) {
//! let store = ditto.store();
//! let collection = store.collection("fancy_name");
//! # }
//! ```
//! And finally add some content inside, which we name
//! [`Document`](crate::store::collection::document).
//! ```
//! # use dittolive_ditto::prelude::Ditto;
//! # use dittolive_ditto::store::collection::Collection;
//! # fn test_collection(collection: Collection) {
//! use serde::{Deserialize, Serialize};
//! #[derive(Serialize, Deserialize)]
//! struct Car {
//!     color: String,
//!     price: u32,
//! }
//! let ford = Car {
//!     color: String::from("black"),
//!     price: 42_000,
//! };
//! //   👇 This is the `DocumentId` which will allow you to edit the Document later
//! let ford_id = collection.upsert(ford);
//! # }
//! ```
// TODO(Ronan) Expand Doc with more advanced use cases

#[allow(unused_imports)]
#[macro_use]
extern crate ext_trait;
#[allow(unused_extern_crates)]
extern crate ffi_sdk;

#[macro_use]
#[doc(hidden)]
/// Internal utility functions / macros
pub mod utils;

pub mod disk_usage;

/// Provides access to authentication information and methods for logging on to Ditto Cloud.
/// Relevant when using an [`OnlineWithAuthentication`](identity::OnlineWithAuthentication)
/// identity.
pub mod auth;

pub mod ditto;

pub mod error;

pub mod identity;

pub mod fs;

pub mod prelude;

pub mod observer;

pub mod small_peer_info;

pub mod store;

pub mod subscription;

pub mod sync;

pub mod transport;

pub mod types;

#[cfg(test)]
pub(crate) mod test_helpers;