Skip to main content

sqlite_containers/
lib.rs

1// SQLite Containers
2// This file is part of the 'SQLite-based containers for Rust' project (sqlite-containers)
3// SPDX-License-Identifier: Unlicense
4
5//! SQLite-based containers for Rust
6//! ================================
7//!
8//! **`sqlite-containers`** provides [*hash set*](https://doc.rust-lang.org/std/collections/struct.HashSet.html) and [*hash map*](https://doc.rust-lang.org/std/collections/struct.HashMap.html) implementations that are backed by **SQLite** in-memory databases.
9//!
10//! Leveraging the power of the SQLite engine, these containers can efficiently store billions of elements.
11//!
12//! Quick Start
13//! -----------
14//!
15//! This example demonstrates how to use **[`SQLiteSet`]**:
16//!
17//! ```rust
18//! use sqlite_containers::SQLiteSet;
19//!
20//! let mut sqlite_set = SQLiteSet::new().expect("Failed to create SQLiteSet!");
21//! let mut tx = sqlite_set.transaction().expect("Failed to init transaction!");
22//!
23//! println!("Inserting elements, please wait...");
24//!
25//! for n in 0..1_000_000u64 {
26//!     tx.insert(&format!("{:016X}", n)).expect("Insertion failed!");
27//! }
28//!
29//! tx.commit();
30//! println!("{} element(s) successfully inserted.", sqlite_set.len().unwrap());
31//! ```
32//!
33//! Acknowledgement
34//! ---------------
35//!
36//! This project is based on the [**SQLite**](https://www.sqlite.org/) library and the [**Rusqlite**](https://crates.io/crates/rusqlite) wrapper for Rust 😻
37//!
38//! License
39//! -------
40//!
41//! The “SQLite-based Containers for Rust” project is released under the [Unlicense](https://unlicense.org/).
42
43mod common;
44mod sqlite_map;
45mod sqlite_set;
46
47pub use crate::common::{Error, SizeT};
48pub use crate::sqlite_map::{SQLiteMap, SQLiteMapTransaction};
49pub use crate::sqlite_set::{SQLiteSet, SQLiteSetTransaction};
50
51pub use rusqlite;