1#![allow(clippy::drop_non_drop)]
2#![deny(
3 clippy::cast_possible_truncation,
4 clippy::cast_possible_wrap,
5 clippy::cast_precision_loss,
6 clippy::cast_sign_loss,
7 clippy::disallowed_methods
8)]
9#![cfg_attr(target_os = "wasi", feature(wasi_ext))]
11
12pub use db::{
57 Builder, Database, MultimapTableDefinition, MultimapTableHandle, RepairSession, StorageBackend,
58 TableDefinition, TableHandle, UntypedMultimapTableHandle, UntypedTableHandle,
59};
60pub use error::{
61 CommitError, CompactionError, DatabaseError, Error, SavepointError, StorageError, TableError,
62 TransactionError,
63};
64pub use multimap_table::{
65 MultimapRange, MultimapTable, MultimapValue, ReadOnlyMultimapTable,
66 ReadOnlyUntypedMultimapTable, ReadableMultimapTable,
67};
68pub use table::{
69 Drain, DrainFilter, Range, ReadOnlyTable, ReadOnlyUntypedTable, ReadableTable, Table,
70 TableStats,
71};
72pub use transactions::{DatabaseStats, Durability, ReadTransaction, WriteTransaction};
73pub use tree_store::{AccessGuard, AccessGuardMut, Savepoint};
74pub use types::{MutInPlaceValue, RedbKey, RedbValue, TypeName};
75
76type Result<T = (), E = StorageError> = std::result::Result<T, E>;
77
78#[cfg(feature = "python")]
79pub use crate::python::redb;
80
81pub mod backends;
82mod complex_types;
83mod db;
84mod error;
85mod multimap_table;
86#[cfg(feature = "python")]
87mod python;
88mod sealed;
89mod table;
90mod transaction_tracker;
91mod transactions;
92mod tree_store;
93mod tuple_types;
94mod types;
95
96#[cfg(test)]
97fn create_tempfile() -> tempfile::NamedTempFile {
98 if cfg!(target_os = "wasi") {
99 tempfile::NamedTempFile::new_in("/").unwrap()
100 } else {
101 tempfile::NamedTempFile::new().unwrap()
102 }
103}