hexadecimal_digits/
lib.rs

1//: - Licensing Information
2
3	/*
4
5		  ╭──────────────────────────────╮
6		╭─┤ SPDX-License-Identifier: MIT ├─────────────────────────────────────────────────╮
7		│ ╰──────────────────────────────╯                                                 │
8		│ Hexadecimal Digits                                                               │
9		│ Provides uppercase and lowercase hexadecimal digit character tables              │
10		│                                                                                  │
11		│ Copyright © 2025 Rachael Ava                                                     │
12		│                                                                                  │
13		│ ╭──────────────────────────────────────────────────────────────────────────────╮ │
14		│ │ Permission is hereby granted, free of charge, to any person obtaining a copy │ │
15		│ │ of this software and associated documentation files (the “Software”), to     │ │
16		│ │ deal in the Software without restriction, including without limitation the   │ │
17		│ │ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  │ │
18		│ │ sell copies of the Software, and to permit persons to whom the Software is   │ │
19		│ │ furnished to do so, subject to the following conditions:                     │ │
20		│ │                                                                              │ │
21		│ │ The above copyright notice and this permission notice shall be included in   │ │
22		│ │ all copies or substantial portions of the Software.                          │ │
23		│ │                                                                              │ │
24		│ │ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR   │ │
25		│ │ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,     │ │
26		│ │ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  │ │
27		│ │ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER       │ │
28		│ │ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      │ │
29		│ │ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS │ │
30		│ │ IN THE SOFTWARE.                                                             │ │
31		│ ╰──────────────────────────────────────────────────────────────────────────────╯ │
32		╰──────────────────────────────────────────────────────────────────────────────────╯
33
34	*/
35
36//: - Module Documentation
37
38	//!
39	//! # Hexadecimal Digits
40	//!
41	//! Provides uppercase and lowercase hexadecimal digit character tables
42	//!
43	//! ---
44	//!
45	//! Have you ever needed to build an array of hexadecimal digits, but
46	//! you're too lazy to do it yourself? Well you've come to the right
47	//! place! This Rust crate comes with both uppercase and lowercase
48	//! arrays of all 16 hexadecimal digits!
49	//!
50	//! ## Usage
51	//!
52	//! The hexadecimal digits are stored simply as an
53	//! [array](https://doc.rust-lang.org/std/primitive.array.html) of
54	//! [`char`](https://doc.rust-lang.org/std/primitive.char.html)s.
55	//! There's nothing fancy happening here. Just use them the same
56	//! way you would with other arrays.
57	//!
58	//! ### Importing
59	//!
60	//! You can import either the uppercase and/or lowercase modules like:
61	//!
62	//! ```rust
63	//! use hexadecimal_digits::{
64	//!     lowercase,
65	//!     uppercase,
66	//! };
67	//! ```
68	//!
69	//! ### Invocation
70	//!
71	//! When you need to use one of the arrays, you can invoke them like:
72	//!
73	//! ```rust
74	//! # use hexadecimal_digits::{
75	//! #     lowercase,
76	//! #     uppercase,
77	//! # };
78	//! #
79	//! # fn main() {
80	//! let lowercase_hexadecimal_a: char = lowercase::HEXADECIMAL_DIGITS[10];
81	//! let uppercase_hexadecimal_f: char = uppercase::HEXADECIMAL_DIGITS[15];
82	//! # }
83	//! ```
84	//!
85	//! ### Re-Exports
86	//!
87	//! If you don't like how long the array names are, re-exports of both
88	//! arrays with shorter names are available for you to use instead like:
89	//!
90	//! ```rust
91	//! # use hexadecimal_digits::{
92	//! #     lowercase,
93	//! #     uppercase,
94	//! # };
95	//! #
96	//! # fn main() {
97	//! let lowercase_hexadecimal_a: char = lowercase::HEX_DIGITS[10];
98	//! let uppercase_hexadecimal_f: char = uppercase::HEX_DIGITS[15];
99	//! # }
100	//! ```
101	//!
102	//! ### Custom Imports
103	//!
104	//! Of course, you can always import them however you want
105	//! and assign custom names for your own projects, like:
106	//!
107	//! ```rust
108	//! use hexadecimal_digits::lowercase::HEXADECIMAL_DIGITS as HEX_LOWER;
109	//! use hexadecimal_digits::uppercase::HEXADECIMAL_DIGITS as HEX_UPPER;
110	//! ```
111	//!
112	//! ## Example
113	//!
114	//! Here's an example of you can do with this crate:
115	//!
116	//! ### Hexadecimal Permutations
117	//!
118	//! This example generates all possible 8-bit hexadecimal numbers.
119	//!
120	//! ```rust
121	//! # use hexadecimal_digits::{
122	//! #     lowercase,
123	//! #     uppercase,
124	//! # };
125	//! #
126	//! # fn main() {
127	//! for digit_1 in lowercase::HEXADECIMAL_DIGITS {
128	//!     for digit_2 in lowercase::HEXADECIMAL_DIGITS {
129	//!         println!("{digit_1}{digit_2}");
130	//!     }
131	//! }
132	//! # }
133	//! ```
134	//!
135
136//: - Crate Attributes
137
138	#![no_std]
139
140//: - Import Modules
141
142	//: Local Moodules
143
144		///
145		/// Provides an array of lowercase hexadecimal digits
146		///
147		pub mod lowercase;
148
149		///
150		/// Provides an array of uppercase hexadecimal digits
151		///
152		pub mod uppercase;