1
0
forked from ROMEO/nexosim

Report panics as errors + identify panicking model

The build context is now passed as a mutable reference due to the need
to mutate data when adding a model.

Contains small unrelated cleanups and documentation improvements too.
This commit is contained in:
Serge Barral
2024-11-13 19:21:54 +01:00
parent e6f77ea8e5
commit ba1e668447
21 changed files with 437 additions and 229 deletions

View File

@ -85,7 +85,7 @@ impl Model for MotorAssembly {}
impl ProtoModel for ProtoMotorAssembly {
type Model = MotorAssembly;
fn build(self, ctx: &BuildContext<Self>) -> MotorAssembly {
fn build(self, ctx: &mut BuildContext<Self>) -> MotorAssembly {
let mut assembly = MotorAssembly::new();
let mut motor = Motor::new(self.init_pos);
let mut driver = Driver::new(1.0);

View File

@ -58,7 +58,7 @@ impl ProtoModel for ProtoListener {
type Model = Listener;
/// Start the UDP Server immediately upon model construction.
fn build(self, _: &BuildContext<Self>) -> Listener {
fn build(self, _: &mut BuildContext<Self>) -> Listener {
let (tx, rx) = channel();
let external_handle = thread::spawn(move || {