cp437_tools/lib.rs
1//! <div align="center">
2//!
3//! ![logo][logo]
4//!
5//! **CP437 tools**
6//!
7//! A small collection of tools to handle CP437 files.
8//!
9//! </div>
10//!
11//! # Binaries
12//!
13//! <div class="warning">
14//!
15//! These require rust nightly, since they make use of the nightly feature
16//! [`try_trait_v2`](https://github.com/rust-lang/rust/issues/84277).
17//!
18//! </div>
19//!
20//! ## Meta handling
21//!
22//! * **cp437-check-meta**
23//!
24//! Reads a file's metadata and run some validations to see if there's any
25//! issues with it.
26//!
27//! * **cp437-read-meta**
28//!
29//! Reads and prints a file's metadata, highlighting values to show potential
30//! errors, as well as showing the effective value when a real one is missing.
31//!
32//! * **cp437-remove-meta**
33//!
34//! Takes a file and strips its metadata, piping the resulting file to stdout.
35//!
36//! * **cp437-set-meta**
37//!
38//! Takes a file and modifies its metadata, piping the resulting file to
39//! stdout.
40//!
41//! If the file has no metadata, it will add one filled with default values,
42//! and then proceed to add set the given field.
43//!
44//! ## Rendering
45//!
46//! * **cp437-to-png**
47//!
48//! Renders the given file as a PNG image, piping the resulting file to
49//! stdout.
50//!
51//! It will also embed the file's metadata, if available.
52//!
53//! ![to-png][png]
54//!
55//! * **cp437-to-svg**
56//!
57//! <div class="warning">
58//! NOTE: This binary is still a WIP. Redering seems to be kinda wonky.
59//! </div>
60//!
61//! Renders the given file as an SVG image, piping the resulting file to
62//! stdout.
63//!
64//! It will also embed the file's metadata, if available.
65//!
66//! ![to-svg][svg]
67//!
68//! * **cp437-to-txt**
69//!
70//! Takes the contents of the file and transpiles them to UTF-8 encoding,
71//! piping the resulting file to stdout.
72//!
73//! ![to-txt][txt]
74//!
75//!
76//! # Library
77//!
78//! <div class="warning">
79//!
80//! Note that this crate is primary written to supply the CLI commands shown
81//! above, not as a reusable library. As such, by default it will pull
82//! unnecessary dependencies.
83//!
84//! To avoid this, disable the default "binaries" feature.
85//!
86//! (see [cargo#1982](https://github.com/rust-lang/cargo/issues/1982) issue for
87//! more details on why this workaround is even needed)
88//!
89//! </div>
90//!
91#![cfg_attr(all(),
92 doc = ::embed_doc_image::embed_image!("logo", "res/logo/tiny.png"),
93 doc = ::embed_doc_image::embed_image!("png", "res/screenshots/png.png"),
94 doc = ::embed_doc_image::embed_image!("svg", "res/screenshots/svg.png"),
95 doc = ::embed_doc_image::embed_image!("txt", "res/screenshots/txt.png"),
96)]
97#![cfg_attr(feature = "binaries", feature(try_trait_v2))] // TODO https://github.com/rust-lang/rust/issues/84277
98
99/// A list of things likely to be required by most dependents.
100pub mod prelude {
101 pub use super::{
102 colour::*,
103 cp437::*,
104 meta::{self, Meta},
105 };
106}
107
108#[expect(clippy::missing_docs_in_private_items, reason = "Just an implementation detail")]
109#[path = "libs/public/mod.rs"]
110mod public;
111pub use self::public::*;
112
113#[path = "libs/internal/mod.rs"]
114#[cfg(feature = "binaries")]
115pub mod internal;