Struct gmt_dos_actors::model::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

§

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

§

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

§

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 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>

§

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

Which kind of future are we turning this into?
§

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,

§

type Item = PlainActor

The type of the elements being iterated over.
§

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> FlowChart for T
where T: GetName, &'a T: for<'a> IntoIterator<Item = PlainActor>,

source§

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

Returns the actors network graph
source§

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

source§

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

Writes the actors flowchart Read more
source§

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

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§

default 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>,

§

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>,

§

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.