Skip to main content

atomr_patterns/ddd/
value_object.rs

1//! [`ValueObject`] — equality-by-value, no identity.
2
3use std::hash::Hash;
4
5/// Marker trait for *value objects*: domain types that are immutable,
6/// compared by value, and have no independent identity. Money, ranges,
7/// addresses, codes — anything that, if you mutated it, would no longer
8/// be the same value.
9///
10/// The trait carries no methods; its sole purpose is to make
11/// "value-objectness" explicit at type sites and to bundle the standard
12/// requirements (`Clone + Eq + Hash + Send + Sync + 'static`) into a
13/// single bound.
14pub trait ValueObject: Clone + Eq + Hash + Send + Sync + 'static {}