pub trait PersonProperty: Copy {
type Value: Copy + Debug + PartialEq + Serialize;
// Required methods
fn compute(context: &Context, person_id: PersonId) -> Self::Value;
fn get_instance() -> Self;
fn name() -> &'static str;
// Provided methods
fn is_derived() -> bool { ... }
fn is_required() -> bool { ... }
fn dependencies() -> Vec<Box<dyn PersonPropertyHolder>> { ... }
}
Expand description
An individual characteristic or state related to a person, such as age or disease status.
Person properties should be defined with the define_person_property!()
,
define_person_property_with_default!()
and define_derived_property!()
macros.
Required Associated Types§
Required Methods§
fn compute(context: &Context, person_id: PersonId) -> Self::Value
fn get_instance() -> Self
fn name() -> &'static str
Provided Methods§
fn is_derived() -> bool
fn is_required() -> bool
fn dependencies() -> Vec<Box<dyn PersonPropertyHolder>>
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.