move CharGrid to own file

This commit is contained in:
Vinzenz Schroeter 2024-11-10 17:46:03 +01:00
parent 85a0ea0dc3
commit 01edc3dfcc
3 changed files with 9 additions and 4 deletions

View file

@ -0,0 +1,4 @@
use crate::PrimitiveGrid;
/// A grid containing UTF-8 characters.
pub type CharGrid = PrimitiveGrid<char>;

View file

@ -10,9 +10,6 @@ use std::collections::HashMap;
/// The encoding is currently not enforced. /// The encoding is currently not enforced.
pub type Cp437Grid = PrimitiveGrid<u8>; pub type Cp437Grid = PrimitiveGrid<u8>;
/// A grid containing UTF-8 characters.
pub type CharGrid = PrimitiveGrid<char>;
/// Errors that can occur when loading CP-437. /// Errors that can occur when loading CP-437.
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]
pub enum Cp437LoadError { pub enum Cp437LoadError {
@ -91,6 +88,7 @@ pub use feature_cp437::*;
#[cfg(feature = "cp437")] #[cfg(feature = "cp437")]
mod feature_cp437 { mod feature_cp437 {
use crate::CharGrid;
use super::*; use super::*;
/// An array of 256 elements, mapping most of the CP437 values to UTF-8 characters /// An array of 256 elements, mapping most of the CP437 values to UTF-8 characters
@ -248,6 +246,7 @@ mod tests {
#[cfg(test)] #[cfg(test)]
#[cfg(feature = "cp437")] #[cfg(feature = "cp437")]
mod tests_feature_cp437 { mod tests_feature_cp437 {
use crate::CharGrid;
use super::*; use super::*;
#[test] #[test]

View file

@ -41,10 +41,11 @@ pub use bitvec;
pub use crate::bitmap::Bitmap; pub use crate::bitmap::Bitmap;
pub use crate::brightness::{Brightness, BrightnessGrid}; pub use crate::brightness::{Brightness, BrightnessGrid};
pub use crate::char_grid::CharGrid;
pub use crate::command::{Command, Offset}; pub use crate::command::{Command, Offset};
pub use crate::compression_code::CompressionCode; pub use crate::compression_code::CompressionCode;
pub use crate::connection::Connection; pub use crate::connection::Connection;
pub use crate::cp437::{CharGrid, Cp437Grid}; pub use crate::cp437::Cp437Grid;
pub use crate::data_ref::DataRef; pub use crate::data_ref::DataRef;
pub use crate::grid::Grid; pub use crate::grid::Grid;
pub use crate::origin::{Origin, Pixels, Tiles}; pub use crate::origin::{Origin, Pixels, Tiles};
@ -55,6 +56,7 @@ pub type BitVec = bitvec::prelude::BitVec<u8, bitvec::prelude::Msb0>;
mod bitmap; mod bitmap;
mod brightness; mod brightness;
mod char_grid;
mod command; mod command;
mod command_code; mod command_code;
mod compression; mod compression;