image_rider/
lib.rs

1#![warn(missing_docs)]
2#![warn(unsafe_code)]
3//! image_rider is a library crate to parse disk and ROM images.  It
4//! primarily focuses on older 8-bit and 16-bit systems.
5//!
6//! The primary API for this library are a set of traits in the
7//! [image_rider::disk_format::image](crate::disk_format::image) module.
8//!
9//! The disk_format module contains everything to parse disk formats
10//!
11use log::error;
12
13pub mod config;
14pub mod disk_format;
15pub mod error;
16pub mod file;
17pub mod serialize;
18
19/// Initialize the module.
20/// This should be called before any parsing is performed.
21/// Panics on failure or if there are any incompatibilities.
22pub fn init() {
23    // If we're on a system with a usize < 32 bits then fail.  This
24    // crate is geared towards parsing file formats for 8-bit systems,
25    // but the code currently does not run on 8-bit systems.  For
26    // example, we read the entire file into a single image data array
27    // and access the data array with usize indexes for several of the
28    // file formats.
29    if usize::BITS < 32 {
30        error!(
31            "Architecture usize {} is too small for this library",
32            usize::BITS
33        );
34        panic!(
35            "Architecture usize {} is too small for this library",
36            usize::BITS
37        );
38    }
39}