18 lines
405 B
Rust
18 lines
405 B
Rust
use std::fmt;
|
|
|
|
#[derive(PartialEq, Clone, Debug)]
|
|
/// Price result
|
|
pub struct PriceResult {
|
|
/// The name of object
|
|
pub name: String,
|
|
/// The product type
|
|
pub product: String,
|
|
/// The price
|
|
pub price: f64
|
|
}
|
|
|
|
impl fmt::Display for PriceResult {
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
write!(f, "Product «{}: {}» price {}€", self.product, self.name, self.price)
|
|
}
|
|
} |