Type Widget::Data is passed by reference and must have lifetime exceeding the widget (i.e. usually 'static). Implications:
- We cannot generate input data on-the-fly; it must be stored in the widget tree somewhere (e.g. it may be generated and cached by
fn Events::update).
- We cannot pass multiple references as input data.
The generic solution to this would be to make type Widget::Data a GAT over a lifetime parameter, but Rust does not currently support usage of GATs in dyn-safe traits (see also #25) and we require that Widget be dyn-safe.
There may be other (partial) solutions, but any evaluated solutions are worse than forcing widgets to work around this limitation. (This might continue to be the case even if Rust does support dyn-safe lifetime GATs, but should be re-evaluated.)
Type
Widget::Datais passed by reference and must have lifetime exceeding the widget (i.e. usually'static). Implications:fn Events::update).The generic solution to this would be to make
type Widget::Dataa GAT over a lifetime parameter, but Rust does not currently support usage of GATs indyn-safe traits (see also #25) and we require thatWidgetbedyn-safe.There may be other (partial) solutions, but any evaluated solutions are worse than forcing widgets to work around this limitation. (This might continue to be the case even if Rust does support
dyn-safe lifetime GATs, but should be re-evaluated.)