Skip to main content

made_core/value_objects/
diversity_preference.rs

1use serde::{Deserialize, Serialize};
2
3/// Whether an agent should seek an intentionally different proposal.
4#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
5pub enum DiversityPreference {
6    #[default]
7    Standard,
8    Diverse,
9}
10
11impl DiversityPreference {
12    #[must_use]
13    pub const fn is_diverse(self) -> bool {
14        matches!(self, Self::Diverse)
15    }
16}
17
18impl From<bool> for DiversityPreference {
19    fn from(diverse: bool) -> Self {
20        if diverse {
21            Self::Diverse
22        } else {
23            Self::Standard
24        }
25    }
26}