[][src]Struct pns::Net

#[repr(C)]
pub struct Net { pub transition_count: u32, pub place_count: u32, // some fields omitted }

A type representing a petri net. It only stores the initial state, not the state used for simulatoin.

Fields

transition_count: u32

The count of transitions of the petri net

place_count: u32

The count of places of the petri net

Methods

impl Net
[src]

pub fn new() -> Net
[src]

Create a new, empty petri net.

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

Load a petri net from a file.

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

Save the petri net to a file. Result represents success.

pub fn transitions(&self) -> &[Node]
[src]

A slice of nodes representing the transitions of the petri net.

pub fn places(&self) -> &[Node]
[src]

A slice of nodes representing the places of the petri net.

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

A slice of initial token counts for the places of the petri net.

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

Add a new transition to the petri net and get the index.

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

Add a new place to the petri net and get the index.

pub fn connect_in(&mut self, tid: u32, pid: u32) -> bool
[src]

Make a connection into transition with index tid from place with index pid.

pub fn connect_out(&mut self, tid: u32, pid: u32) -> bool
[src]

Make a connection out from the transitoin with index tid to place with index pid. Result represents success.

pub fn duplicate_transition(&mut self, tid: u32) -> u32
[src]

Duplicate the transition and get the index of the clone.

pub fn duplicate_place(&mut self, pid: u32) -> u32
[src]

Duplicate the place and get the index of the clone.

pub fn start(&mut self, pid: u32, count: u32) -> u32
[src]

Increase the initial token count in place indexed by pid.

Trait Implementations

impl Drop for Net
[src]

impl Debug for Net
[src]

Auto Trait Implementations

impl !Send for Net

impl !Sync for Net

Blanket Implementations

impl<T> From for T
[src]

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

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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