1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! HexEntity trait for domain objects with unique identity.
//!
//! Entities are objects that have a unique identity that persists over time,
//! even if their attributes change. Two entities are considered equal if they
//! have the same identity, regardless of their attribute values.
//! Entities are mutable by nature as their state can change while maintaining identity.
//! The identity type is defined via an associated type for maximum flexibility.
//!
//! Revision History
//! - 2025-10-09T09:43:00Z @AI: Rename Entity to HexEntity for consistency.
//! - 2025-10-01T00:00:00Z @AI: Initial Entity trait definition with associated type Id.
/// Trait for domain entities with unique identity.
///
/// Entities have an identity that persists over time. Two entities with the same
/// identity are considered the same entity, even if their attributes differ.
///
/// # Example
///
/// ```rust
/// use hexser::domain::HexEntity;
///
/// struct User {
/// id: String,
/// email: String,
/// }
///
/// impl HexEntity for User {
/// type Id = String;
/// }
/// ```