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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#![doc = include_str!("../README.md")]
#![allow(
    // This lint is allowed because the following
    // code exists a lot in this crate:
    //
    // ```rust
    // let env_inner = env.env_inner();
    // let tx_rw = env_inner.tx_rw()?;
    // OpenTables::create_tables(&env_inner, &tx_rw)?;
    // ```
    //
    // Rust thinks `env_inner` can be dropped earlier
    // but it cannot, we need it for the lifetime of
    // the database transaction + tables.
    clippy::significant_drop_tightening
)]
// Allow some lints in tests.
#![cfg_attr(
    test,
    allow(
        clippy::cognitive_complexity,
        clippy::needless_pass_by_value,
        clippy::cast_possible_truncation,
        clippy::too_many_lines
    )
)]

//---------------------------------------------------------------------------------------------------- Public API
// Import private modules, export public types.
//
// Documentation for each module is located in the respective file.

mod backend;
mod constants;
mod database;
mod env;
mod error;
mod key;
mod storable;
mod table;
mod tables;
mod transaction;

pub mod config;
pub mod resize;

pub use backend::ConcreteEnv;
pub use constants::{
    DATABASE_BACKEND, DATABASE_CORRUPT_MSG, DATABASE_DATA_FILENAME, DATABASE_LOCK_FILENAME,
};
pub use database::{DatabaseIter, DatabaseRo, DatabaseRw};
pub use env::{Env, EnvInner};
pub use error::{InitError, RuntimeError};
pub use key::{Key, KeyCompare};
pub use storable::{Storable, StorableBytes, StorableStr, StorableVec};
pub use table::Table;
pub use transaction::{TxRo, TxRw};

//---------------------------------------------------------------------------------------------------- Private
#[cfg(test)]
pub(crate) mod tests;

// Used inside public facing macros.
#[doc(hidden)]
pub use paste;

//----------------------------------------------------------------------------------------------------
// HACK: needed to satisfy the `unused_crate_dependencies` lint.
cfg_if::cfg_if! {
    if #[cfg(feature = "redb")]  {
        use redb as _;
    } else {
        use heed as _;
    }
}