Conversation
|
|
||
| event_seq.push(fut); | ||
|
|
||
| let key = peek_next_key(&mut scheduler_queue, time); |
There was a problem hiding this comment.
@sbarral please note, here time is used (previously upper_time_bound was bound in the closure). Since we break on the key mismatch I think there is no logical change here. Please check however :)
|
|
||
| event_seq.push(fut); | ||
|
|
||
| let key = peek_next_key(&mut scheduler_queue, time); |
| /// | ||
| /// If successsful returns a bool value indicating whether at least one item has | ||
| /// been spawned. | ||
| fn handle_scheduler_step( |
There was a problem hiding this comment.
I would write a comment here or maybe in the calling code just before the call to synchronize about the fact that dropping/consuming the scheduler (and injector) guards is necessary for correctness. This is subtle and could be lost in a future refactoring.
nexosim/src/model/context.rs
Outdated
| /// this model. | ||
| /// | ||
| /// Event arguments are mapped to another type using the closure provided. | ||
| pub fn mapped_event_injector<F, C, T, U, S>(&self, func: F, map: C) -> EventInjector<T> |
There was a problem hiding this comment.
Sorry I just realize now that it would be better to have a consuming mapped method that transforms an Injector<T> into an Injector<U> because most frequently it is the user of the injector that will want to adapt it to its needs.
There was a problem hiding this comment.
Since we already store a future in the event injector I had to use a bit of a matrioshka approach. (a side effect of this is that in theory user can stack the mappings if they wish).
nexosim/src/simulation/injector.rs
Outdated
| /// specific deadline. A `ModelInjector` is always associated to a model | ||
| /// instance. | ||
| pub struct ModelInjector<M: Model> { | ||
| /// specific deadline. A `EventInjector` is always associated to a model |
There was a problem hiding this comment.
"A EventInjector" -> "An EventInjector"
nexosim/src/model/context.rs
Outdated
| } | ||
|
|
||
| /// Returns an injector associated to this model. | ||
| #[deprecated = "please use `event_injector` method instead"] |
| /// Returns an injector associated to this model. | ||
| #[deprecated = "please use `event_injector` method instead"] | ||
| #[allow(deprecated)] | ||
| pub fn injector(&self) -> ModelInjector<P::Model> { |
There was a problem hiding this comment.
Should we hide all deprecated items in the docs perhaps with docs(hidden)? I don't know what is the general practice.
There was a problem hiding this comment.
I think hiding is a good idea, since I do not think it has been used much (regardless of the common practice - if such exists)
nexosim/src/simulation/injector.rs
Outdated
| /// If a stepping method such as | ||
| /// [`Simulation::step`](crate::simulation::Simulation::step) or | ||
| /// [`Simulation::run`](crate::simulation::Simulation::run) is executed | ||
| /// concurrently, the event will be processed at the deadline set by the |
Changes: