(
all_inst: &AllInstructions,
get_attr: T,
name: &'static str,
doc: &'static str,
fmt: &mut Formatter,
)
| 576 | } |
| 577 | |
| 578 | fn gen_bool_accessor<T: Fn(&Instruction) -> bool>( |
| 579 | all_inst: &AllInstructions, |
| 580 | get_attr: T, |
| 581 | name: &'static str, |
| 582 | doc: &'static str, |
| 583 | fmt: &mut Formatter, |
| 584 | ) { |
| 585 | fmt.doc_comment(doc); |
| 586 | fmt.add_block(&format!("pub fn {name}(self) -> bool"), |fmt| { |
| 587 | let mut m = Match::new("self"); |
| 588 | for inst in all_inst.iter() { |
| 589 | if get_attr(inst) { |
| 590 | m.arm_no_fields(format!("Self::{}", inst.camel_name), "true"); |
| 591 | } |
| 592 | } |
| 593 | m.arm_no_fields("_", "false"); |
| 594 | fmt.add_match(m); |
| 595 | }); |
| 596 | fmt.empty_line(); |
| 597 | } |
| 598 | |
| 599 | fn gen_opcodes(all_inst: &AllInstructions, fmt: &mut Formatter) { |
| 600 | fmt.doc_comment( |
no test coverage detected