crates-testing-bilal 0.1.1

A crate made with rust.
Documentation
#[derive(Debug)]
struct Rectangle<T> {
    width: u32,
    height: u32,
    operation: T,
    product: Option<u32>,
}

impl<T> Rectangle<T>
where
    T: Fn(u32, u32) -> u32,
    T: FnMut(u32, u32) -> u32,
{
    fn new(width: u32, height: u32, operation: T) -> Rectangle<T> {
        Rectangle {
            width,
            height,
            operation,
            product: None,
        }
    }

    fn run_operation(&mut self) {
        self.product = Some((self.operation)(self.width, self.height));
    }
}

fn main() {
    let mut rect = Rectangle::new(50, 30, |x, y| x * y);
    rect.run_operation();
    println!(
        "The area of the rectangle with width {} and height {} is {}",
        rect.width,
        rect.height,
        rect.product.unwrap_or_else(|| 0)
    );
}