Skip to content

Conversation

@shanecelis
Copy link
Contributor

Just a convenience method I found useful.

I removed some panic comments on the with_component_*() because I don't believe they panic, but I didn't affirm that with tests.

Accepts Option<&T>. Should not panic if component is not available.
@makspll
Copy link
Owner

makspll commented Jan 22, 2025

Looks good! The only thing I'd say is the function could be slightly more lenient in terms of claiming access when the component does exist (in which case it could just claim access to it) but I am not too bothered atm and that could be changed later

@makspll makspll changed the title Add world.with_or_insert_component_mut() feat: Add world.with_or_insert_component_mut() Jan 22, 2025
@makspll makspll merged commit b2c39d0 into makspll:staging Jan 22, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants