[][src]Struct pns::State

#[repr(C)]
pub struct State<'net> {
    pub net: &'net Net,
    pub forward: bool,
    // some fields omitted
}

The state of the petri net used for simulation.

Fields

net: &'net Net

A reference to the petri net

forward: bool

Check if current play direction is forward.

Methods

impl<'_> State<'_>[src]

pub fn added_transitions(&mut self, forward: bool) -> Box<[u32]>[src]

Get a list of newly fireable transitions in the specified direction since the last call of this method. Automatically clears that list.

pub fn removed_transitions(&mut self, forward: bool) -> Box<[u32]>[src]

Get a list of nomore fireable transitions in the specified direction since the last call of this method. Automatically clears that list.

impl<'net> State<'net>[src]

pub fn new(net: &'net Net) -> State<'net>[src]

Create a new, empty state for simulation of a petri net. The state is bound to the lifetime of the simulated net.

pub fn load(net: &'net Net, filename: &str) -> Option<State<'net>>[src]

Load a simulation state from a file. Using the wrong file layout will fail or create confusing state.

pub fn save(&self, filename: &str) -> bool[src]

Save the current state of the simulation.

pub fn call_counts(&self) -> &[u32][src]

List the current call counts of all transitions. Counts are counted down again when playing backwards.

pub fn token_counts(&self) -> &[u32][src]

List the current token counts of all transitions.

pub fn fire<'state>(&'state mut self) -> FireState<'net, 'state>[src]

Generate a FireState to fire a transition later.

pub fn reverse(&mut self) -> bool[src]

Reverse the play direction. Result represents forward.

Trait Implementations

impl<'_> Drop for State<'_>[src]

impl<'_> Clone for State<'_>[src]

Auto Trait Implementations

impl<'net> !Send for State<'net>

impl<'net> Unpin for State<'net>

impl<'net> !Sync for State<'net>

impl<'net> RefUnwindSafe for State<'net>

impl<'net> UnwindSafe for State<'net>

Blanket Implementations

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> From<T> for T[src]

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.

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

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

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