Anchor makes your life easier by providing you macros that write code for you.

For example, if you remember the Debug macro implements default debug implementation for structs

#[derive(Debug)]
struct Rect {
    width: u32,
    height: u32,
}

let rect = Rect {
    width: 10,
    height: 20,
};
println!("Rect: {:?}", rect);

Gets converted to


impl Debug for Rect {
    fn fmt(&self, f: &mut Formatter) -> Result {
				Formatter::debug_struct_field2_finish(
            f,
            "Rect",
            "width",
            &self.width,
            "height",
            &self.height,
        )
    }
}

You can do it manually as well, but it gets difficult to write this code. Macros create generic outputs for your structs/variables.