fn execute(input: &[Instruction], part_2: bool) -> u16 {
    let mut wires = HashMap::with_capacity(input.len());
    let mut instructions = HashMap::with_capacity(input.len());

    for i in input.iter() {
        instructions.insert(i.dest.as_ref(), i);
    }

    let b_override = Instruction {
        operation: Operation::Set(Source::Raw(16076u16)),
        dest: instructions["b"].dest.clone(),
    };

    if part_2 {
        // override b with the value from part 1
        instructions.insert("b", &b_override);
    }

    get_value_by_wire("a", &mut wires, &instructions)
}
/// Execute the given instructions
///
/// - *input* - Input instructions
/// - *part_2* - indicates whether part 2 is running or not
Execute the given instructions
*input* - Input instructions
*part_2* - indicates whether part 2 is running or not
Execute the given instructions * input * - Input instructions * part_2 * - indicates whether part 2 is running or not
fn execute(input: &[Instruction], part_2: bool) -> u16 {
    let mut wires = HashMap::with_capacity(input.len());
    let mut instructions = HashMap::with_capacity(input.len());
    for i in input.iter() {
        instructions.insert(i.dest.as_ref(), i);
    }
    let b_override = Instruction {
        operation: Operation::Set(Source::Raw(16076u16)),
        dest: instructions["b"].dest.clone(),
    };
    if part_2 {
        // override b with the value from part 1
        instructions.insert("b", &b_override);
    }
    get_value_by_wire("a", &mut wires, &instructions)
}
fn execute ( input : & [ Instruction ] , part_2 : bool ) -> u16 { let mut wires = HashMap :: with_capacity ( input . len ( ) ) ; let mut instructions = HashMap :: with_capacity ( input . len ( ) ) ; for i in input . iter ( ) { instructions . insert ( i . dest . as_ref ( ) , i ) ; } let b_override = Instruction { operation : Operation :: Set ( Source :: Raw ( 16076u16 ) ) , dest : instructions [ " " ] . dest . clone ( ) , } ; if part_2 { // override b with the value from part 1 instructions . insert ( " " , & b_override ) ; } get_value_by_wire ( " " , & mut wires , & instructions ) }
Execute the given instructions
 *input* - Input instructions
 *part_2* - indicates whether part 2 is running or not
Execute the given instructions * input * - Input instructions * part_2 * - indicates whether part 2 is running or not
input
&[Instruction]
part_2
bool
input
&[Instruction]
part_2
bool