Skip to main content

ValueObject

Trait ValueObject 

Source
pub trait ValueObject:
    Clone
    + Eq
    + Hash
    + Send
    + Sync
    + 'static { }
Expand description

Marker trait for value objects: domain types that are immutable, compared by value, and have no independent identity. Money, ranges, addresses, codes — anything that, if you mutated it, would no longer be the same value.

The trait carries no methods; its sole purpose is to make “value-objectness” explicit at type sites and to bundle the standard requirements (Clone + Eq + Hash + Send + Sync + 'static) into a single bound.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§