c64_assembler/builder/
module.rs

1use crate::{Function, Instructions, Module};
2
3#[derive(Default, Clone)]
4pub struct ModuleBuilder {
5    module: Module,
6}
7
8impl ModuleBuilder {
9    pub fn name(&mut self, name: &str) -> &mut Self {
10        self.module.name = name.to_string();
11        self
12    }
13
14    pub fn instructions(&mut self, instructions: Instructions) -> &mut Self {
15        self.module.instructions = instructions;
16        self
17    }
18    pub fn function(&mut self, function: Function) -> &mut Self {
19        self.module.functions.push(function);
20        self
21    }
22
23    pub fn build(&self) -> Module {
24        self.module.clone()
25    }
26}