The idea is a replacement for the old show(ui) -> (Response, SomeCustomAction) pattern, which sucked. New one is just to implement Displays, but also have a field that contains the action that should be dealt with after calling ui(). The trait would look something like this:
trait Acts {
type Action;
// Returns the pending action, if any, and resets it to None.
fn take_action(&mut self) -> Option<Action>;
}
// callers
let response = entity.ui(ui);
if let Some(action) = entity.take_action() {
// deal with it
}
The idea is a replacement for the old
show(ui) -> (Response, SomeCustomAction)
pattern, which sucked. New one is just to implementDisplays
, but also have a field that contains the action that should be dealt with after callingui()
. The trait would look something like this: