This derive macro creates a new associated function receiving as parameters the same fields declared in your struct.
So this:
... will create this:
This derive macro creates a new associated function receiving as parameters the same fields declared in your struct.
So this:
#[derive(New)]
struct Cube {
r: i32,
c: i32,
z: i32,
w: i32,
}
... will create this:
impl Cube {
fn new(r: i32, c: i32, z: i32, w: i32) -> Self {
Self { r, c, z, w }
}
}