pub struct ActorModel<A, C = (), H = ()>where
    A: Actor,
    H: Clone + Debug + Hash,{
    pub actors: Vec<A>,
    pub cfg: C,
    pub init_history: H,
    pub init_network: Network<A::Msg>,
    pub lossy_network: LossyNetwork,
    pub max_crashes: usize,
    pub properties: Vec<Property<ActorModel<A, C, H>>>,
    pub record_msg_in: fn(cfg: &C, history: &H, envelope: Envelope<&A::Msg>) -> Option<H>,
    pub record_msg_out: fn(cfg: &C, history: &H, envelope: Envelope<&A::Msg>) -> Option<H>,
    pub within_boundary: fn(cfg: &C, state: &ActorModelState<A, H>) -> bool,
}
Expand description

Represents a system of Actors that communicate over a network. H indicates the type of history to maintain as auxiliary state, if any. See Auxiliary Variables in TLA for a thorough introduction to that concept. Use () if history is not needed to define the relevant properties of this system.

Fields§

§actors: Vec<A>§cfg: C§init_history: H§init_network: Network<A::Msg>§lossy_network: LossyNetwork§max_crashes: usize

Maximum number of actors that can be contemporarily crashed

§properties: Vec<Property<ActorModel<A, C, H>>>§record_msg_in: fn(cfg: &C, history: &H, envelope: Envelope<&A::Msg>) -> Option<H>§record_msg_out: fn(cfg: &C, history: &H, envelope: Envelope<&A::Msg>) -> Option<H>§within_boundary: fn(cfg: &C, state: &ActorModelState<A, H>) -> bool

Implementations§

source§

impl<A, C, H> ActorModel<A, C, H>where A: Actor, H: Clone + Debug + Hash,

source

pub fn new(cfg: C, init_history: H) -> ActorModel<A, C, H>

Initializes an ActorModel with a specified configuration and history.

source

pub fn actor(self, actor: A) -> Self

Adds another Actor to this model.

source

pub fn actors(self, actors: impl IntoIterator<Item = A>) -> Self

Adds multiple Actors to this model.

source

pub fn init_network(self, init_network: Network<A::Msg>) -> Self

Defines the initial network.

source

pub fn lossy_network(self, lossy_network: LossyNetwork) -> Self

Defines whether the network loses messages or not.

source

pub fn max_crashes(self, max_crashes: usize) -> Self

Specifies the maximum number of actors that can be contemporarily crashed

source

pub fn property( self, expectation: Expectation, name: &'static str, condition: fn(_: &ActorModel<A, C, H>, _: &ActorModelState<A, H>) -> bool ) -> Self

Adds a Property to this model.

source

pub fn record_msg_in( self, record_msg_in: fn(cfg: &C, history: &H, _: Envelope<&A::Msg>) -> Option<H> ) -> Self

Defines whether/how an incoming message contributes to relevant history. Returning Some(new_history) updates the relevant history, while None does not.

source

pub fn record_msg_out( self, record_msg_out: fn(cfg: &C, history: &H, _: Envelope<&A::Msg>) -> Option<H> ) -> Self

Defines whether/how an outgoing message contributes to relevant history. Returning Some(new_history) updates the relevant history, while None does not.

source

pub fn within_boundary( self, within_boundary: fn(cfg: &C, state: &ActorModelState<A, H>) -> bool ) -> Self

Indicates whether a state is within the state space that should be model checked.

Trait Implementations§

source§

impl<A, C: Clone, H> Clone for ActorModel<A, C, H>where A: Actor + Clone, H: Clone + Debug + Hash + Clone, A::Msg: Clone,

source§

fn clone(&self) -> ActorModel<A, C, H>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<A, C, H> Model for ActorModel<A, C, H>where A: Actor, H: Clone + Debug + Hash,

source§

fn as_svg(&self, path: Path<Self::State, Self::Action>) -> Option<String>

Draws a sequence diagram for the actor system.

§

type State = ActorModelState<A, H>

The type of state upon which this model operates.
§

type Action = ActorModelAction<<A as Actor>::Msg, <A as Actor>::Timer>

The type of action that transitions between states.
source§

fn init_states(&self) -> Vec<Self::State>

Returns the initial possible states.
source§

fn actions(&self, state: &Self::State, actions: &mut Vec<Self::Action>)

Collects the subsequent possible actions based on a previous state.
source§

fn next_state( &self, last_sys_state: &Self::State, action: Self::Action ) -> Option<Self::State>

Converts a previous state and action to a resulting state. None indicates that the action does not change the state.
source§

fn format_action(&self, action: &Self::Action) -> String

Converts an action of this model to a more intuitive representation (e.g. for Explorer).
source§

fn format_step( &self, last_state: &Self::State, action: Self::Action ) -> Option<String>where Self::State: Debug,

Converts a step of this model to a more intuitive representation (e.g. for Explorer).
source§

fn properties(&self) -> Vec<Property<Self>>

Generates the expected properties for this model.
source§

fn within_boundary(&self, state: &Self::State) -> bool

Indicates whether a state is within the state space that should be model checked.
source§

fn next_steps( &self, last_state: &Self::State ) -> Vec<(Self::Action, Self::State)>

Indicates the steps (action-state pairs) that follow a particular state.
source§

fn next_states(&self, last_state: &Self::State) -> Vec<Self::State>

Indicates the states that follow a particular state. Slightly more efficient than calling Model::next_steps and projecting out the states.
source§

fn property(&self, name: &'static str) -> Property<Self>

Looks up a property by name. Panics if the property does not exist.

Auto Trait Implementations§

§

impl<A, C, H> RefUnwindSafe for ActorModel<A, C, H>where A: RefUnwindSafe, C: RefUnwindSafe, H: RefUnwindSafe, <A as Actor>::Msg: RefUnwindSafe,

§

impl<A, C, H> Send for ActorModel<A, C, H>where A: Send, C: Send, H: Send, <A as Actor>::Msg: Send,

§

impl<A, C, H> Sync for ActorModel<A, C, H>where A: Sync, C: Sync, H: Sync, <A as Actor>::Msg: Sync,

§

impl<A, C, H> Unpin for ActorModel<A, C, H>where A: Unpin, C: Unpin, H: Unpin, <A as Actor>::Msg: Unpin,

§

impl<A, C, H> UnwindSafe for ActorModel<A, C, H>where A: UnwindSafe, C: UnwindSafe, H: UnwindSafe, <A as Actor>::Msg: UnwindSafe + RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V