Model

Struct Model 

Source
pub struct Model<State> { /* private fields */ }
Expand description

Actor model

Implementations§

Source§

impl Model<Ready>

Source

pub fn run(self) -> Model<Running>

Spawns each actor task

Source§

impl Model<Running>

Source

pub async fn wait(self) -> Result<Model<Completed>, ModelError>

Waits for the task of each actor to finish

Source§

impl Model<Unknown>

Source

pub fn new(actors: Vec<Box<dyn Task>>) -> Self

Returns a new model

Source

pub fn name<S: Into<String>>(self, name: S) -> Self

Sets the model name

Source

pub fn quiet(self) -> Self

Quiet mode

Source

pub fn check(self) -> Result<Model<Ready>, ModelError>

Validates actors inputs and outputs

Source

pub fn skip_check(self) -> Model<Ready>

Source§

impl<S> Model<S>

Source

pub fn inspect(self) -> Self

Prints some informations about the model and the actors within

Source

pub fn n_io(&self) -> (usize, usize)

Returns the total number of inputs and the total number of outputs

Both numbers should be the same

Source

pub fn n_actors(&self) -> usize

Returns the number of actors

Source

pub fn get_name(&self) -> String

Source

pub fn elapsed_time(&self) -> Duration

Trait Implementations§

Source§

impl<C, const NI: usize, const NO: usize> Add<Actor<C, NI, NO>> for Model<Unknown>
where C: Update + 'static,

Aggregation of a model and an actor into a new model

Source§

type Output = Model<Unknown>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Actor<C, NI, NO>) -> Self::Output

Performs the + operation. Read more
Source§

impl<C, const NI: usize, const NO: usize> Add<Model<Unknown>> for Actor<C, NI, NO>
where C: Update + 'static,

Aggregation of an actor and a model into a new model

Source§

type Output = Model<Unknown>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Model<Unknown>) -> Self::Output

Performs the + operation. Read more
Source§

impl Add for Model<Unknown>

Aggregation of models into a new model

Source§

type Output = Model<Unknown>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl<C, const NI: usize, const NO: usize> AddAssign<Actor<C, NI, NO>> for Model<Unknown>
where C: Update + 'static,

Source§

fn add_assign(&mut self, rhs: Actor<C, NI, NO>)

Performs the += operation. Read more
Source§

impl Default for Model<Unknown>

Source§

fn default() -> Self

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

impl<S> Display for Model<S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<S: UnknownOrReady> FlowChart for Model<S>

Source§

fn graph(&self) -> Option<Graph>

Returns the actors network graph
Source§

fn to_html(&self) -> Result<PathBuf, FlowChartError>

Writes the flowchart to an HTML file Read more
Source§

fn flowchart(self) -> Self
where Self: Sized,

Writes the actors flowchart to an HTML file Read more
Source§

fn flowchart_open(self) -> Self
where Self: Sized,

Writes the actors flowchart to an HTML file and open it in the default browser
Source§

impl FromIterator<Box<dyn Task>> for Model<Unknown>

Source§

fn from_iter<T: IntoIterator<Item = Box<dyn Task>>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl<State> GetName for Model<State>
where State: UnknownOrReady,

Source§

fn get_name(&self) -> String

Returns the flowchart name
Source§

impl IntoFuture for Model<Running>

Source§

type IntoFuture = Pin<Box<dyn Future<Output = Result<Model<Completed>, ModelError>> + Send>>

Which kind of future are we turning this into?
Source§

type Output = <Pin<Box<dyn Future<Output = Result<Model<Completed>, ModelError>> + Send>> as Future>::Output

The output that the future will produce on completion.
Source§

fn into_future(self) -> Self::IntoFuture

Creates a future from a value. Read more
Source§

impl<State> IntoIterator for &Model<State>
where State: UnknownOrReady,

Source§

type Item = PlainActor

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<<&Model<State> as IntoIterator>::Item>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<State> Freeze for Model<State>

§

impl<State> !RefUnwindSafe for Model<State>

§

impl<State> Send for Model<State>
where State: Send,

§

impl<State> Sync for Model<State>
where State: Sync,

§

impl<State> Unpin for Model<State>
where State: Unpin,

§

impl<State> !UnwindSafe for Model<State>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.