Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename ArgList::push methods to with and add new push methods which take &mut self #16567

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

atornity
Copy link
Contributor

Objective

The ArgList::push family of methods consume self and return a new ArgList which means they can't be used with &mut ArgList references.

fn foo(args: &mut ArgList) {
    args.push_owned(47_i32); // doesn't work :(
}

It's typical for push methods on other existing types to take &mut self.

Solution

Renamed the existing push methods to with_arg, with_ref etc and added new push methods which take &mut self.

Migration Guide

Uses of the ArgList::push methods should be replaced with the with counterpart.

old new
push_arg with_arg
push_ref with_ref
push_mut with_mut
push_owned with_owned
push_boxed with_boxed

@MrGVSV MrGVSV added C-Usability A targeted quality-of-life change that makes Bevy easier to use A-Reflection Runtime information about types D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Nov 30, 2024
@MrGVSV MrGVSV self-requested a review November 30, 2024 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Reflection Runtime information about types C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants