#![forbid(unsafe_code)]
#![warn(
clippy::cargo,
missing_docs,
// clippy::missing_docs_in_private_items,
clippy::nursery,
clippy::pedantic,
future_incompatible,
rust_2018_idioms,
)]
#![cfg_attr(doc, deny(rustdoc))]
#![allow(
clippy::missing_errors_doc, // TODO clippy::missing_errors_doc
clippy::option_if_let_else,
)]
#[cfg(feature = "networking")]
pub use fabruic;
pub mod connection;
pub mod document;
pub mod limits;
#[cfg(feature = "networking")]
pub mod networking;
pub mod schema;
pub mod transaction;
use schema::collection;
use serde::{Deserialize, Serialize};
#[derive(Clone, thiserror::Error, Debug, Serialize, Deserialize)]
pub enum Error {
#[error("error from storage: {0}")]
Storage(String),
#[error("error from server: {0}")]
Server(String),
#[error("a transport error occurred: '{0}'")]
Transport(String),
#[cfg(feature = "websockets")]
#[error("a websocket error occurred: '{0}'")]
Websocket(String),
#[cfg(feature = "networking")]
#[error("a networking error occurred: '{0}'")]
Networking(networking::Error),
#[error("an io error occurred: '{0}'")]
Io(String),
#[error("a configuration error occurred: '{0}'")]
Configuration(String),
#[error("an io error in the client: '{0}'")]
Client(String),
#[error("attempted to access a collection not registered with this schema")]
CollectionNotFound,
#[error("the requested document id {1} from collection {0} was not found")]
DocumentNotFound(collection::Id, u64),
#[error("a conflict was detected while updating document id {1} from collection {0}")]
DocumentConflict(collection::Id, u64),
}
impl From<serde_cbor::Error> for Error {
fn from(err: serde_cbor::Error) -> Self {
Self::Storage(err.to_string())
}
}
#[cfg(any(feature = "test-util", test))]
#[allow(missing_docs)]
pub mod test_util;