on 5f6e310 help sign in
bat/tests/snapshots/sample.rs
18 lines 361 B history raw
1struct Rectangle {
2 width: u32,
3 height: u32,
4}
6fn main() {
7 // width and height of a rectangle can be different
8 let rect1 = Rectangle { width: 30, height: 50 };
10 println!(
11 "The area of the rectangle is {} square pixels.",
12 area(&rect1)
13 );
16fn area(rectangle: &Rectangle) -> u32 {
17 rectangle.width * rectangle.height