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

ReflectKind struct #11657

Closed
doonv opened this issue Feb 1, 2024 · 0 comments · Fixed by #11664
Closed

ReflectKind struct #11657

doonv opened this issue Feb 1, 2024 · 0 comments · Fixed by #11664
Labels
A-Reflection Runtime information about types C-Feature A new feature, making something new possible

Comments

@doonv
Copy link
Contributor

doonv commented Feb 1, 2024

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

Allow an easy way of storing the kind of a reflected type.

What solution would you like?

Add a ReflectKind struct, which is like ReflectRef, ReflectMut, and ReflectOwned but only the kind of the type.

This kinda already exists in bevy_reflect, used in the context of Access related errors.

pub enum TypeKind {

However I think it should be moved to be used in a more general context.

@doonv doonv added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Feb 1, 2024
@tim-blackbird tim-blackbird added A-Reflection Runtime information about types and removed S-Needs-Triage This issue needs to be labelled labels Feb 1, 2024
@doonv doonv mentioned this issue Feb 2, 2024
github-merge-queue bot pushed a commit that referenced this issue Feb 7, 2024
# Objective

Fix #11657

## Solution

Add a `ReflectKind` enum, add `Reflect::reflect_kind` which returns a
`ReflectKind`, and add `kind` method implementions to `ReflectRef`,
`ReflectMut`, and `ReflectOwned`, which returns a `ReflectKind`.

I also changed `AccessError` to use this new struct instead of it's own
`TypeKind` struct.

---

## Changelog

- Added `ReflectKind`, an enumeration over the kinds of a reflected type
without its data.
- Added `Reflect::reflect_kind` (with default implementation)
- Added implementation for the `kind` method on `ReflectRef`,
`ReflectMut`, and `ReflectOwned` which gives their kind without any
information, as a `ReflectKind`
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-Feature A new feature, making something new possible
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants