rig/loaders/mod.rs
1//! This module provides utility structs for loading and preprocessing files.
2//!
3//! The `FileLoader` struct can be used to define a common interface for loading any type of files from disk,
4//! as well as performing minimal preprocessing on the files, such as reading their contents, ignoring errors
5//! and keeping track of file paths along with their contents.
6//!
7//! The `PdfFileLoader` works similarly to the [FileLoader], but is specifically designed to load PDF
8//! files. This loader also provides PDF-specific preprocessing methods for splitting the PDF into pages
9//! and keeping track of the page numbers along with their contents.
10//!
11//! Note: The `PdfFileLoader` requires the `pdf` feature to be enabled in the `Cargo.toml` file.
12//!
13//! The `EpubFileLoader` works similarly to the `FileLoader`, but is specifically designed to load EPUB
14//! files. This loader also provides EPUB-specific preprocessing methods for splitting the EPUB into chapters
15//! and keeping track of the chapter numbers along with their contents.
16//!
17//! Note: The EpubFileLoader requires the `epub` feature to be enabled in the `Cargo.toml` file.
18
19pub mod file;
20
21pub use file::FileLoader;
22
23#[cfg(feature = "pdf")]
24#[cfg_attr(docsrs, doc(cfg(feature = "pdf")))]
25pub mod pdf;
26
27#[cfg(feature = "pdf")]
28pub use pdf::PdfFileLoader;
29
30#[cfg(feature = "epub")]
31#[cfg_attr(docsrs, doc(cfg(feature = "epub")))]
32pub mod epub;
33
34#[cfg(feature = "epub")]
35pub use epub::{EpubFileLoader, RawTextProcessor, StripXmlProcessor, TextProcessor};