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
`ebook-rs` provides a clean, unified API for loading, inspecting, searching, and displaying eBooks in Rust applications.
---
Add `ebook-rs` to your `Cargo.toml`:
```toml
[dependencies]
ebook-rs = "0.12.0"
```
---
```rust
use ebook_rs::Book;
fn main() -> Result<(), String> {
}
```
```rust
let matches = book.search("Wonderland");
for m in matches {
}
```
```rust
// Generate discrete location chunks (1000 characters per location)
book.generate_locations(1000);
let total_locs = book.locations.total_locations;
let progress = book.locations.percentage_from_location(5);
println!("Total Locations: {}, Progress at loc 5: {:.2}%", total_locs, progress * 100.0);
```