2024-06-26 21:51:06 +00:00
|
|
|
#![doc = include_str!("../README.md")]
|
|
|
|
#![allow(
|
2024-09-02 17:12:54 +00:00
|
|
|
// 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
|
2024-06-26 21:51:06 +00:00
|
|
|
)]
|
|
|
|
// 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;
|
2024-07-11 13:20:56 +00:00
|
|
|
mod constants;
|
|
|
|
mod database;
|
|
|
|
mod env;
|
|
|
|
mod error;
|
|
|
|
mod key;
|
|
|
|
mod storable;
|
|
|
|
mod table;
|
|
|
|
mod tables;
|
|
|
|
mod transaction;
|
2024-06-26 21:51:06 +00:00
|
|
|
|
|
|
|
pub mod config;
|
2024-07-11 13:20:56 +00:00
|
|
|
pub mod resize;
|
2024-06-26 21:51:06 +00:00
|
|
|
|
2024-07-11 13:20:56 +00:00
|
|
|
pub use backend::ConcreteEnv;
|
2024-06-26 21:51:06 +00:00
|
|
|
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};
|
2024-07-01 19:24:48 +00:00
|
|
|
pub use key::{Key, KeyCompare};
|
|
|
|
pub use storable::{Storable, StorableBytes, StorableStr, StorableVec};
|
2024-06-26 21:51:06 +00:00
|
|
|
pub use table::Table;
|
|
|
|
pub use transaction::{TxRo, TxRw};
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------- Private
|
|
|
|
#[cfg(test)]
|
|
|
|
pub(crate) mod tests;
|
|
|
|
|
2024-07-11 13:20:56 +00:00
|
|
|
// Used inside public facing macros.
|
|
|
|
#[doc(hidden)]
|
|
|
|
pub use paste;
|
|
|
|
|
2024-06-26 21:51:06 +00:00
|
|
|
//----------------------------------------------------------------------------------------------------
|
|
|
|
// HACK: needed to satisfy the `unused_crate_dependencies` lint.
|
|
|
|
cfg_if::cfg_if! {
|
|
|
|
if #[cfg(feature = "redb")] {
|
|
|
|
use redb as _;
|
|
|
|
} else {
|
|
|
|
use heed as _;
|
|
|
|
}
|
|
|
|
}
|