bevyengine / bevyengine/bevy

Plugin::build should accept self not &self

Open
#17,298 2 comments 0 reactions 0 assignees View on GitHub
A-App C-Feature X-Contentious
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## 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>`. 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>`.

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.