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) -> Builder
pub fn place(self, label: &str, initial: f64) -> Builder
Adds a place with the given label and initial token count.
Sourcepub fn place_with_capacity(
self,
label: &str,
initial: f64,
capacity: f64,
) -> Builder
pub fn place_with_capacity( self, label: &str, initial: f64, capacity: f64, ) -> Builder
Adds a place with initial tokens and capacity limit.
Sourcepub fn transition(self, label: &str) -> Builder
pub fn transition(self, label: &str) -> Builder
Adds a transition with the given label.
Sourcepub fn transition_with_role(self, label: &str, role: &str) -> Builder
pub fn transition_with_role(self, label: &str, role: &str) -> Builder
Adds a transition with a specific role.
Sourcepub fn arc(self, source: &str, target: &str, weight: f64) -> Builder
pub fn arc(self, source: &str, target: &str, weight: f64) -> Builder
Adds an arc from source to target with the given weight.
Sourcepub fn inhibitor_arc(self, source: &str, target: &str, weight: f64) -> Builder
pub fn inhibitor_arc(self, source: &str, target: &str, weight: f64) -> Builder
Adds an inhibitor arc from source to target.
Sourcepub fn flow(
self,
from_place: &str,
transition: &str,
to_place: &str,
weight: f64,
) -> Builder
pub fn flow( self, from_place: &str, transition: &str, to_place: &str, weight: f64, ) -> Builder
Adds bidirectional arcs for a flow pattern: place -> transition -> place.
Sourcepub fn chain(self, initial_tokens: f64, elements: &[&str]) -> Builder
pub fn chain(self, initial_tokens: f64, elements: &[&str]) -> Builder
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) -> Builder
pub fn sir(self, susceptible: f64, infected: f64, recovered: f64) -> Builder
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