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
//! A file archive format and virtual filesystem backed by a SQLite database.
//!
//! This library is a Rust implementation of the [sqlar](https://sqlite.org/sqlar.html) format for
//! SQLite archive files.
//!
//! ```
//! use std::io::prelude::*;
//!
//! use sqlarfs::Connection;
//!
//! fn main() -> sqlarfs::Result<()> {
//! let mut conn = Connection::open_in_memory()?;
//!
//! let expected = "hello world";
//!
//! let actual = conn.exec(|archive| {
//! let mut dir = archive.open("path/to")?;
//! dir.create_dir_all()?;
//!
//! let mut file = archive.open("path/to/file")?;
//! file.create_file()?;
//!
//! file.write_str(expected)?;
//!
//! let mut actual = String::new();
//! let mut reader = file.reader()?;
//!
//! reader.read_to_string(&mut actual)?;
//!
//! sqlarfs::Result::Ok(actual)
//! })?;
//!
//! assert_eq!(actual, expected);
//!
//! Ok(())
//! }
//! ```
//!
//! To open a SQLite archive, create a new [`Connection`]. From there, you can call
//! [`Connection::exec`] to execute a closure within a transaction. This closure will be passed an
//! [`Archive`], which is the main type for reading and writing to the archive.
// This requires the nightly toolchain.
pub use Archive;
pub use ;
pub use File;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;