1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use crate::error::Error;
use crate::file_writer;
use crate::generators::CodeGen;
use std::fs::File;

const ASCII7: std::ops::Range<u32> = std::ops::Range {
    start: 0x0021,
    end: 0x007E,
};

/// Generates the [`ASCII7`](https://datatracker.ietf.org/doc/html/rfc8264#section-9.11)
/// table required by the PRECIS framework.
pub struct Ascii7Gen {}

impl Ascii7Gen {
    /// Creates a new table generator for `ASCII7`
    pub fn new() -> Self {
        Self {}
    }
}

impl Default for Ascii7Gen {
    fn default() -> Self {
        Self::new()
    }
}

impl CodeGen for Ascii7Gen {
    fn generate_code(&mut self, file: &mut File) -> Result<(), Error> {
        file_writer::generate_code_from_range(file, "ascii7", &ASCII7)
    }
}