pub struct Product { /* private fields */ }Expand description
Represents a product.
Implementations§
Source§impl Product
impl Product
Sourcepub fn calculate_product_price(&self) -> f64
pub fn calculate_product_price(&self) -> f64
Calculates the total price of the product including tax.
§Returns
The total price of the product.
§Example
use structure_test::Category;
use structure_test::Product;
let product = Product::new(1, "Shirt".to_string(), 20.0, Category::Clothing);
let total_price = product.calculate_product_price();
assert_eq!(total_price, 21.0);Trait Implementations§
impl StructuralPartialEq for Product
Auto Trait Implementations§
impl Freeze for Product
impl RefUnwindSafe for Product
impl Send for Product
impl Sync for Product
impl Unpin for Product
impl UnwindSafe for Product
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more