mame_parser/
lib.rs

1//! `mame-parser` is a Rust library that simplifies the management and processing of files containing MAME (Multiple Arcade Machine Emulator) information.
2//! The library provides a suite of tools to automate the download, decompression, parsing, and exporting of MAME data,
3//! making it easier to handle and manipulate this data in various formats.
4//!
5//! # Features
6//!
7//! - **File Downloading**: Download the latest MAME-related files and store them in a specified location.
8//! - **File Decompression**: Decompress downloaded files, supporting multiple archive formats like ZIP and 7z.
9//! - **Data Parsing and Management**: Parse MAME data files with utilities for reading and handling the information in-memory.
10//! - **Multi-format Exporting**: Export parsed data to multiple formats, such as JSON, CSV, or SQLite.
11//! - **Progress Tracking**: Monitor the progress of operations.
12//!
13//! # Crate Contents
14//!
15//! * [`File handling`](file_handling) - Provides functions and utilities for downloading, unpacking, reading and writing MAME data files.
16//! * [`Progress tracking`](progress) - Contains tools and types for tracking and managing progress updates during operations.
17//! * [`Crate models`](models) - Defines data types and models used for representing MAME data.
18//! * [`Mame files readers`](readers) - Contains functions for reading and parsing different MAME data file formats.
19//!
20//! # Examples
21//!
22//! You can find examples of how to use the library in the `examples` directory of the repository.
23//! Also each function in the file_handling module has its own documentation with examples.
24//!
25mod core;
26mod helpers;
27
28/// Module to handle the callback functions used for progress tracking.
29pub use core::models::callback_progress as progress;
30/// Management of MAME data files, including downloading, reading, and unpacking.
31pub mod file_handling {
32    pub use crate::core::data_cleanup::machine_filtering::{
33        remove_machines_by_category, remove_machines_by_filter,
34    };
35    pub use crate::core::file_handling::file_downloader::{download_file, download_files};
36    pub use crate::core::file_handling::file_reader::{read_file, read_files};
37    pub use crate::core::file_handling::file_unpacker::{unpack_file, unpack_files};
38    pub use crate::core::file_handling::file_writer::write_files;
39}
40/// Data models and types used for MAME data processing.
41pub mod models {
42    pub use crate::core::data_cleanup::machine_filtering::Category;
43    pub use crate::core::data_cleanup::machine_filtering::MachineFilter;
44    pub use crate::core::file_handling::file_writer::ExportFileType;
45    pub use crate::core::models::core_models::*;
46    pub use crate::core::models::mame_data_types::MameDataType;
47
48    pub mod collections {
49        pub use crate::core::models::collections_helper::get_categories_list;
50        pub use crate::core::models::collections_helper::get_languages_list;
51        pub use crate::core::models::collections_helper::get_manufacturers_list;
52        pub use crate::core::models::collections_helper::get_players_list;
53        pub use crate::core::models::collections_helper::get_series_list;
54        pub use crate::core::models::collections_helper::get_subcategories_list;
55    }
56}
57
58/// Module for reading and parsing MAME data files.
59pub mod readers {
60    pub use crate::core::readers::catver_reader::read_catver_file;
61    pub use crate::core::readers::history_reader::read_history_file;
62    pub use crate::core::readers::languages_reader::read_languages_file;
63    pub use crate::core::readers::mame_reader::read_mame_file;
64    pub use crate::core::readers::nplayers_reader::read_nplayers_file;
65    pub use crate::core::readers::resources_reader::read_resources_file;
66    pub use crate::core::readers::series_reader::read_series_file;
67}