c64_assembler/builder/
function.rs1use crate::{Function, Instructions};
2
3#[derive(Default, Clone)]
4pub struct FunctionBuilder {
5 function: Function,
6}
7
8impl FunctionBuilder {
9 pub fn name(&mut self, name: &str) -> &mut Self {
10 self.function.name = name.to_string();
11 self
12 }
13
14 pub fn doc(&mut self, documentation: &[&str]) -> &mut Self {
15 for d in documentation {
16 self.function.documentation.push(d.to_string());
17 }
18 self
19 }
20
21 pub fn instructions(&mut self, instructions: Instructions) -> &mut Self {
22 self.function.instructions = instructions;
23 self
24 }
25
26 pub fn build(&self) -> Function {
27 self.function.clone()
28 }
29}