[][src]Struct agent_safety_layers::AgentZ

pub struct AgentZ<M, A, D> {
    pub model: M,
    pub decider: fn(_: &M) -> A,
    pub actor: fn(_: &mut M, _: A),
    pub mutater: fn(_: &mut M) -> D,
    pub undoer: fn(_: &mut M, _: D),
}

Stores an agent that only acts, assuming its model is perfect.

Fields

model: M

Stores the model.

decider: fn(_: &M) -> A

Decides what to do based on some model.

actor: fn(_: &mut M, _: A)

Performs an action on the model.

mutater: fn(_: &mut M) -> D

Mutates the model and returns a delta change.

undoer: fn(_: &mut M, _: D)

Undoes a delta change by resetting the model.

Methods

impl<M, A, D> AgentZ<M, A, D>[src]

pub fn add(self, n: usize) -> AgentN<M, A, D>[src]

Add extra layers of safety.

Trait Implementations

impl<M, A, D> Agent for AgentZ<M, A, D>[src]

type Model = M

The type of the model.

type Action = A

The type of actions.

type Delta = D

The type of delta changes (caused by mutation).

impl<M: Clone, A: Clone, D: Clone> Clone for AgentZ<M, A, D>[src]

Auto Trait Implementations

impl<M, A, D> RefUnwindSafe for AgentZ<M, A, D> where
    M: RefUnwindSafe

impl<M, A, D> Send for AgentZ<M, A, D> where
    M: Send

impl<M, A, D> Sync for AgentZ<M, A, D> where
    M: Sync

impl<M, A, D> Unpin for AgentZ<M, A, D> where
    M: Unpin

impl<M, A, D> UnwindSafe for AgentZ<M, A, D> where
    M: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.