1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#![forbid(unsafe_code)]
#![warn(
clippy::cargo,
missing_docs,
clippy::nursery,
clippy::pedantic,
future_incompatible,
rust_2018_idioms,
)]
#![cfg_attr(doc, warn(rustdoc))]
#![allow(
clippy::missing_errors_doc,
clippy::option_if_let_else,
)]
pub mod connection;
pub mod document;
pub mod schema;
pub mod transaction;
use schema::collection;
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("error working with storage: {0}")]
Storage(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;