Skip to content

Plugin::build should accept self not &self #17298

Open
@UkoeHB

Description

@UkoeHB

What problem does this solve or what need does it fill?

Currently to drill an allocated object into plugins you either need to use a resource or Arc<Mutex<>>. It would nice for the default, most common case to allow consuming plugin content on build..

What solution would you like?

The Plugin trait should only have one method: build(self, &mut App). The existing Plugin trait should be renamed to FullPlugin, and its methods should be &mut not &.

What alternative(s) have you considered?

Continue using resources/Arc<Mutex<>>.

Additional context

IIRC the current &self restriction is from the old plugin design. Don't see any reason or docs saying the plugin methods can't be mutable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-AppBevy apps and pluginsC-FeatureA new feature, making something new possibleX-ContentiousThere are nontrivial implications that should be thought through

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions