[−][src]Derive Macro domain_derive::Entity
#[derive(Entity)]
The Entity
derive macro can be used to automatically implement all methods of the Entity
trait
from the domain_patterns
crate. This only works if certain preconditions are met:
- You are applying this to a struct.
- Your struct has an
id
field of typeUuid
. - Your struct has a
version
field which is some integer type.
ⓘThis code runs with edition 2018
#[macro_use] extern crate domain_derive; use uuid::Uuid; #[derive(Entity)] struct User { id: Uuid, version: u64 };