-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Add panicking versions of get_component
and get
#9443
Comments
Hmm, I can see the value in that, especially for consistency with Maybe Or we could do |
This sounds like something that requires |
Perhaps |
Agree, I like it! |
Hi, I'm a new contributor and would like to take this on as a first issue. I do have some experience porting the What does this function do in particular? I noticed it calls |
It checks if a query with
Yes, you will need to call new methods here. |
@IAmSegfault are you planning to start working on it? |
Sure if you want to take over that's fine. I've been busy with work lately and was going to try squeeze in time before the next release. |
get_component
and get
get_component
and get
# Objective - Currently we don't have panicking alternative for getting components from `Query` like for resources. Partially addresses #9443. ## Solution - Add these functions. --- ## Changelog ### Added - `Query::component` and `Query::component_mut` to get specific component from query and panic on error.
…#9659) # Objective - Currently we don't have panicking alternative for getting components from `Query` like for resources. Partially addresses bevyengine#9443. ## Solution - Add these functions. --- ## Changelog ### Added - `Query::component` and `Query::component_mut` to get specific component from query and panic on error.
No longer relevant since |
What problem does this solve or what need does it fill?
It's annoying to call
unwrap
orexpect
onget
orget_component
calls if you know that the entity will contain the component for sure. Happens a lot if you working with hierarchy or reference entities in components.What solution would you like?
It would be great to have panicking versions for convenience. I think that
get_component(_mut)
could havecomponent(_mut)
alternative. Butget
need to be renamed toget_entity
in order to have panickingentity
function. I would like to hear your thoughts about it.The text was updated successfully, but these errors were encountered: