Struct pnets::standard::Net[][src]

pub struct Net {
    pub name: String,
    pub transitions: IndexVec<TransitionId, Transition>,
    pub places: IndexVec<PlaceId, Place>,
    // some fields omitted
}
Expand description

Standard Petri net, with only produce and consume arcs

This structure is indexed with PlaceId and TransitionId to allow easy access to places and transitions.

As this kind of network is a subset of timed Petri net, so we can create one from timed Petri net (but you loose arc::Kind::Inhibitor, arc::Kind::StopWatch and arc::Kind::StopWatchInhibitor arcs and timings).

Fields

name: String

Name of this network

transitions: IndexVec<TransitionId, Transition>

Transitions of the network

places: IndexVec<PlaceId, Place>

Places of the network

Implementations

Create a place in the network without name and return its index

Create a transition in the network without name and return its index

Get node name with its id

Get node id with its name

Rename node

Add an arc in the network. This kind of network support only arc::Kind::Consume and arc::Kind::Produce arcs.

Errors

Return NetError::UnsupportedArc when trying to add a kind of arc which is not supported

Disconnect a place in the network

The place is not really deleted to avoid memory relocation and extra information about this place such as name can be useful later.

Disconnect a transition in the network

The transition is not really deleted to avoid memory relocation and extra information about this transitions such as name can be useful later.

Clone an existing place with all its arcs

Create a new network without all disconected nodes and without labels to avoid extra memory consumption.

It returns a new network and the mapping between old indexes and new indexes.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Performs the conversion.

Performs the conversion.

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

Performs the mutable indexing (container[index]) operation. Read more

Performs the mutable indexing (container[index]) operation. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

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

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.