Skip to content

Support passing multiple input data references / lifetime GATs #488

@dhardy

Description

@dhardy

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.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions