pub struct Council { /* private fields */ }Expand description
A council owns the set of agent identities that participate in deliberations for its specialty. The membership must be non-empty for the council to be capable of deliberating.
Implementations§
Source§impl Council
impl Council
Sourcepub fn new(
id: CouncilId,
specialty: Specialty,
agents: impl IntoIterator<Item = AgentId>,
now: OffsetDateTime,
) -> Result<Self, DomainError>
pub fn new( id: CouncilId, specialty: Specialty, agents: impl IntoIterator<Item = AgentId>, now: OffsetDateTime, ) -> Result<Self, DomainError>
Create a council seeded with at least one agent.
A zero-agent council cannot deliberate; constructing one is rejected here rather than later in the use-case layer.
Sourcepub fn add_agent(&mut self, agent: AgentId)
pub fn add_agent(&mut self, agent: AgentId)
Add an agent. Idempotent: re-adding the same agent is a no-op, not an error.
Sourcepub fn remove_agent(&mut self, agent: &AgentId) -> Result<(), DomainError>
pub fn remove_agent(&mut self, agent: &AgentId) -> Result<(), DomainError>
Remove an agent. Rejects the removal if it would empty the council — an empty council cannot deliberate.
pub fn id(&self) -> &CouncilId
pub fn specialty(&self) -> &Specialty
pub fn agents(&self) -> &BTreeSet<AgentId>
pub fn size(&self) -> usize
pub fn created_at(&self) -> OffsetDateTime
pub fn has_agent(&self, agent: &AgentId) -> bool
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Council
impl<'de> Deserialize<'de> for Council
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Council
impl StructuralPartialEq for Council
Auto Trait Implementations§
impl Freeze for Council
impl RefUnwindSafe for Council
impl Send for Council
impl Sync for Council
impl Unpin for Council
impl UnsafeUnpin for Council
impl UnwindSafe for Council
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more