Hi! Thanks for opening an issue. Please provide some specific details to make it easier to debug any
problems.
Environment
Description of the problem/feature request/other
In the program I'm writing, I expect occasional failures to enter OP, generally because of unconfigured SDOs, which is fine for my application. In that event, I'd like to gracefully shutdown the EtherCAT bus. However, that's not possible. Observe,
let group = match group.into_op(&maindevice).await {
Ok(group) => group,
Err(err) => {
group.into_init(&maindevice).await?; // ERROR: group was moved above and can't be used anymore
time_to_exit();
}
}
The state transition failure, along with the borrow checker, make it so group cannot be interacted with after a state transition failure. So the question is how to solve this.
I have a couple thoughts, and I wonder what's the most right?
- Create a new group with
MainDevice; I think it should work as-is, but it feels hacky
- Add a reference to a valid
SubDeviceGroup in the Err type; this allows the cleanup, but makes handling Err possibly more complicated
- Have
MainDevice shut down the bus on Drop
Hi! Thanks for opening an issue. Please provide some specific details to make it easier to debug any
problems.
Environment
Description of the problem/feature request/other
In the program I'm writing, I expect occasional failures to enter OP, generally because of unconfigured SDOs, which is fine for my application. In that event, I'd like to gracefully shutdown the EtherCAT bus. However, that's not possible. Observe,
The state transition failure, along with the borrow checker, make it so
groupcannot be interacted with after a state transition failure. So the question is how to solve this.I have a couple thoughts, and I wonder what's the most right?
MainDevice; I think it should work as-is, but it feels hackySubDeviceGroupin theErrtype; this allows the cleanup, but makes handling Err possibly more complicatedMainDeviceshut down the bus onDrop