pub struct Net { /* private fields */ }Expand description
A Colored Petri Net (CPN).
Implementations§
Source§impl Net
impl Net
Sourcepub fn seed_rng(&mut self, seed: u64)
pub fn seed_rng(&mut self, seed: u64)
Seed (or re-seed) the PRNG.
This may be desirable to enable reproducible simulations.
Sourcepub fn add_place<P>(&mut self, place: P) -> Result<()>
pub fn add_place<P>(&mut self, place: P) -> Result<()>
Add a place with the given name to the net.
Sourcepub fn add_places<P, I>(&mut self, places: I) -> Result<()>
pub fn add_places<P, I>(&mut self, places: I) -> Result<()>
Add multiple places at once.
Sourcepub fn places(&self) -> impl Iterator<Item = &Place>
pub fn places(&self) -> impl Iterator<Item = &Place>
Get an iterator over references of the contained places.
Sourcepub fn add_transition(&mut self, transition: Transition) -> Result<()>
pub fn add_transition(&mut self, transition: Transition) -> Result<()>
Add the given transition to the net.
After it has been added, use add_arc to connect it to places.
Sourcepub fn add_in_arc(&mut self, from: &str, to: &str, binding: &str) -> Result<()>
pub fn add_in_arc(&mut self, from: &str, to: &str, binding: &str) -> Result<()>
Add an arc from the place to the transition.
Sourcepub fn add_out_arc(
&mut self,
from: &str,
to: &str,
expression: Expression,
) -> Result<()>
pub fn add_out_arc( &mut self, from: &str, to: &str, expression: Expression, ) -> Result<()>
Add an arc from the transition to the place.
Sourcepub fn add_arcs<'a, I>(&mut self, specs: I) -> Result<()>where
I: IntoIterator<Item = ArcSpec<'a>>,
pub fn add_arcs<'a, I>(&mut self, specs: I) -> Result<()>where
I: IntoIterator<Item = ArcSpec<'a>>,
Add multiple arcs at once.
This function is intended to be used together with the arcs! macro.
Sourcepub fn empty_marking(&self) -> Marking
pub fn empty_marking(&self) -> Marking
Create an empty marking for this net.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Net
impl !RefUnwindSafe for Net
impl !Send for Net
impl !Sync for Net
impl Unpin for Net
impl !UnwindSafe for Net
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more