diff --git a/01.workspace/heave/examples/simple_product.rs b/01.workspace/heave/examples/simple_product.rs index 69c1a2b..cadeba6 100644 --- a/01.workspace/heave/examples/simple_product.rs +++ b/01.workspace/heave/examples/simple_product.rs @@ -1,6 +1,7 @@ use heave::*; // Define a struct named `Product` to represent a product. +#[derive(PartialEq)] struct Product { // `id` is a public field of type `String` to uniquely identify the product. pub id: String, diff --git a/01.workspace/heave/examples/working_with_many_types.rs b/01.workspace/heave/examples/working_with_many_types.rs index c4cab2d..5221a09 100644 --- a/01.workspace/heave/examples/working_with_many_types.rs +++ b/01.workspace/heave/examples/working_with_many_types.rs @@ -1,23 +1,27 @@ use heave::*; use std::path::Path; +#[derive(PartialEq)] struct Laptop { pub id: String, pub model: String, pub price: u64, } +#[derive(PartialEq)] struct Display { pub id: String, pub model: String, pub resolution: f64, pub price: u64, } +#[derive(PartialEq)] struct Mouse { pub id: String, pub model: String, pub wireless: bool, pub price: u64, } +#[derive(PartialEq)] enum Product { None, Laptop(Laptop), diff --git a/01.workspace/heave/src/trt/eav.rs b/01.workspace/heave/src/trt/eav.rs index 6115c78..2a872de 100644 --- a/01.workspace/heave/src/trt/eav.rs +++ b/01.workspace/heave/src/trt/eav.rs @@ -7,6 +7,7 @@ use crate::*; pub trait T where Self: TryFrom, Self: TryInto, + Self: PartialEq, { /// Returns the class name of the type. ///