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
//! # stack-db
//! > A (basically) infinitely stacking database that has both readonly safety and incredible write speeds at the same time.
//! 
//! ## Examples
//! ---
//! ### Example of a basic in-memory binary database
//! Here is a basic in-memory database that only deals with binary indexes and data (that uses the allocators provided by the library)
//! ```rust
//! use stack_db::prelude::*;
//! 
//! let allocator = SkdbMemAlloc; // or `SkdbDiskAlloc::new()`
//! let mut database = StackDB::new(allocator);
//! 
//! // writing
//! database.write(256, b"hello, ").unwrap();
//! database.write(256+7, b"world").unwrap();
//! 
//! // reading
//! assert_eq!(&*database.read(256..268).unwrap(), b"hello, world");
//! 
//! // flush to save all changes
//! database.flush().unwrap();
//! 
//! // over-writting
//! database.write(256, b"H").unwrap();
//! database.write(256+7, b"W").unwrap();
//! database.write(268, b"!").unwrap();
//! 
//! // flush again
//! database.flush().unwrap();
//! 
//! // reading
//! assert_eq!(&*database.read(256..269).unwrap(), b"Hello, World!");
//! 
//! // rebase to save space
//! database.rebase(256).unwrap(); // rebase with a 256 byte buffer
//! ```

pub mod base;
pub mod errors;
pub mod prelude;
pub mod default;

#[cfg(debug_assertions)]
#[allow(dead_code)]
fn check_iter_val<T: std::fmt::Debug>(value: T) -> T {
    dbg!(&value);
    value
}