precis_tools/generators/
ascii7.rs

1use crate::error::Error;
2use crate::file_writer;
3use crate::generators::CodeGen;
4use std::fs::File;
5
6const ASCII7: std::ops::Range<u32> = std::ops::Range {
7    start: 0x0021,
8    end: 0x007E,
9};
10
11/// Generates the [`ASCII7`](https://datatracker.ietf.org/doc/html/rfc8264#section-9.11)
12/// table required by the PRECIS framework.
13pub struct Ascii7Gen {}
14
15impl Ascii7Gen {
16    /// Creates a new table generator for `ASCII7`
17    pub fn new() -> Self {
18        Self {}
19    }
20}
21
22impl Default for Ascii7Gen {
23    fn default() -> Self {
24        Self::new()
25    }
26}
27
28impl CodeGen for Ascii7Gen {
29    fn generate_code(&mut self, file: &mut File) -> Result<(), Error> {
30        file_writer::generate_code_from_range(file, "ascii7", &ASCII7)
31    }
32}