pub struct Builder { /* private fields */ }Expand description
Fluent builder for Petri net construction.
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn place(self, label: &str, initial: f64) -> Self
pub fn place(self, label: &str, initial: f64) -> Self
Adds a place with the given label and initial token count.
Sourcepub fn place_with_capacity(
self,
label: &str,
initial: f64,
capacity: f64,
) -> Self
pub fn place_with_capacity( self, label: &str, initial: f64, capacity: f64, ) -> Self
Adds a place with initial tokens and capacity limit.
Sourcepub fn transition(self, label: &str) -> Self
pub fn transition(self, label: &str) -> Self
Adds a transition with the given label.
Sourcepub fn transition_with_role(self, label: &str, role: &str) -> Self
pub fn transition_with_role(self, label: &str, role: &str) -> Self
Adds a transition with a specific role.
Sourcepub fn arc(self, source: &str, target: &str, weight: f64) -> Self
pub fn arc(self, source: &str, target: &str, weight: f64) -> Self
Adds an arc from source to target with the given weight.
Sourcepub fn inhibitor_arc(self, source: &str, target: &str, weight: f64) -> Self
pub fn inhibitor_arc(self, source: &str, target: &str, weight: f64) -> Self
Adds an inhibitor arc from source to target.
Sourcepub fn flow(
self,
from_place: &str,
transition: &str,
to_place: &str,
weight: f64,
) -> Self
pub fn flow( self, from_place: &str, transition: &str, to_place: &str, weight: f64, ) -> Self
Adds bidirectional arcs for a flow pattern: place -> transition -> place.
Sourcepub fn chain(self, initial_tokens: f64, elements: &[&str]) -> Self
pub fn chain(self, initial_tokens: f64, elements: &[&str]) -> Self
Creates a sequential chain of places connected by transitions.
Elements must be odd length: place, trans, place, trans, place…
The first place gets initial_tokens, all others get 0.
Sourcepub fn sir(self, susceptible: f64, infected: f64, recovered: f64) -> Self
pub fn sir(self, susceptible: f64, infected: f64, recovered: f64) -> Self
Creates a standard SIR epidemic model.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnsafeUnpin for Builder
impl UnwindSafe for Builder
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