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:
@ -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);
|
||||
|
@ -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 || {
|
||||
|
Reference in New Issue
Block a user