pub fn from_input(input: &[u8]) -> Self {
        let mut parse_idx = 0;
        let mut template_idx = 0;
        let mut template = [0; TEMPLATE_SIZE];
        let mut memory = Memory::new();
        let mut rules = RuleTable::new();
        loop {
            match unsafe { input.get_unchecked(parse_idx) } {
                b'\n' => {
                    break;
                }
                x => {
                    let elem_idx = index_of_elem(*x);
                    template[template_idx] = elem_idx;
                    template_idx += 1;
                    parse_idx += 1;
                }
            }
        }
        parse_idx += 2;
        let length = input.len();
        while parse_idx < length {
            let x = index_of_elem(*unsafe { input.get_unchecked(parse_idx) });
            let y = index_of_elem(*unsafe { input.get_unchecked(parse_idx + 1) });
            let z = index_of_elem(*unsafe { input.get_unchecked(parse_idx + 6) });
            rules.add_rule(x, y, z);
            memory.add_rule(x, y, z);
            parse_idx += 8;
        }
        Self {
            memory,
            template,
            rules,
        }
    }
// Parses input and executes one step
Parses input and executes one step
Parses input and executes one step
pub fn from_input(input: &[u8]) -> Self {
        let mut parse_idx = 0;
        let mut template_idx = 0;
        let mut template = [0; TEMPLATE_SIZE];
        let mut memory = Memory::new();
        let mut rules = RuleTable::new();
        loop {
            match unsafe { input.get_unchecked(parse_idx) } {
                b'\n' => {
                    break;
                }
                x => {
                    let elem_idx = index_of_elem(*x);
                    template[template_idx] = elem_idx;
                    template_idx += 1;
                    parse_idx += 1;
                }
            }
        }
        parse_idx += 2;
        let length = input.len();
        while parse_idx < length {
            let x = index_of_elem(*unsafe { input.get_unchecked(parse_idx) });
            let y = index_of_elem(*unsafe { input.get_unchecked(parse_idx + 1) });
            let z = index_of_elem(*unsafe { input.get_unchecked(parse_idx + 6) });
            rules.add_rule(x, y, z);
            memory.add_rule(x, y, z);
            parse_idx += 8;
        }
        Self {
            memory,
            template,
            rules,
        }
    }
pub fn from_input ( input : & [ u8 ] ) -> Self { let mut parse_idx = 0 ; let mut template_idx = 0 ; let mut template = [ 0 ; TEMPLATE_SIZE ] ; let mut memory = Memory :: new ( ) ; let mut rules = RuleTable :: new ( ) ; loop { match unsafe { input . get_unchecked ( parse_idx ) } { b'\n' => { break ; } x => { let elem_idx = index_of_elem ( * x ) ; template [ template_idx ] = elem_idx ; template_idx += 1 ; parse_idx += 1 ; } } } parse_idx += 2 ; let length = input . len ( ) ; while parse_idx < length { let x = index_of_elem ( * unsafe { input . get_unchecked ( parse_idx ) } ) ; let y = index_of_elem ( * unsafe { input . get_unchecked ( parse_idx + 1 ) } ) ; let z = index_of_elem ( * unsafe { input . get_unchecked ( parse_idx + 6 ) } ) ; rules . add_rule ( x , y , z ) ; memory . add_rule ( x , y , z ) ; parse_idx += 8 ; } Self { memory , template , rules , } }
Parses input and executes one step
Parses input and executes one step
input
&[u8]