pub struct NodeInner<D: Domain> { /* private fields */ }
Expand description
The data associated to a node that form its key.
Implementations§
Source§impl<D: Domain> NodeInner<D>
impl<D: Domain> NodeInner<D>
Sourcepub fn new(
initial_state: &D::State,
start_tick: u64,
diff: D::Diff,
active_agent: AgentId,
tick: u64,
tasks: BTreeSet<ActiveTask<D>>,
) -> Self
pub fn new( initial_state: &D::State, start_tick: u64, diff: D::Diff, active_agent: AgentId, tick: u64, tasks: BTreeSet<ActiveTask<D>>, ) -> Self
Create a new node, check for visible agents, and re-assign current tasks to the matching ones. Return None if no active agent is not visible, and Some(node) otherwise.
Sourcepub fn agents(&self) -> BTreeSet<AgentId>
pub fn agents(&self) -> BTreeSet<AgentId>
Returns all agents that are in considered by this node
Sourcepub fn current_value(&self, agent: AgentId) -> AgentValue
pub fn current_value(&self, agent: AgentId) -> AgentValue
Returns the current value from an agent, panic if not present in the node
Sourcepub fn current_value_or_compute(
&self,
agent: AgentId,
initial_state: &D::State,
) -> AgentValue
pub fn current_value_or_compute( &self, agent: AgentId, initial_state: &D::State, ) -> AgentValue
Returns the current value from an agent, compute if not present in the node
Sourcepub fn current_values(&self) -> &BTreeMap<AgentId, AgentValue>
pub fn current_values(&self) -> &BTreeMap<AgentId, AgentValue>
Returns all current values
pub fn size(&self, task_size: fn(&dyn Task<D>) -> usize) -> usize
Trait Implementations§
impl<D: Domain> Eq for NodeInner<D>
Auto Trait Implementations§
impl<D> Freeze for NodeInner<D>
impl<D> !RefUnwindSafe for NodeInner<D>
impl<D> Send for NodeInner<D>
impl<D> Sync for NodeInner<D>
impl<D> Unpin for NodeInner<D>
impl<D> !UnwindSafe for NodeInner<D>
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.