| marp | true |
|---|
Build a rust binary package which prints the following pattern for 50 lines :
*
**
***
****
*****
Build a rust binary package which prints the maximum and minimum of a u32 array containing 10 numbers.
let arr:[u32;10] = [4,8,9,7,6,5,2,3,1,0];Add a new shape "Rectangle" with fields
- width: u32
- height: u32
impl "Shape" trait for "Rectangle" with the "get_area" method
Prepare a rust program to create an enum RainbowColors and demonstrate use of match keyword with it.
Create a generic 2D point struct called Point. implement display_point method for the struct.
Implement the Eatable trait for FoodBasket
struct FoodBasket {
food_items_remaining: Option<u32>
}
trait Eatable {
fn display_status(&self);
fn eat_all(&mut self);
}- Note: display "No food remaining" if basket is empty, else count of food items.
- eat_all clears ALL items in the food basket
Implement From for the following struct where T is a tuple of 3 numbers:
struct Pixel {
r: u8,
g: u8,
b: u8
}