mirror of
https://github.com/bevyengine/bevy
synced 2024-11-29 08:00:20 +00:00
1248a639ee
There are cases where we want an enum variant name. Right now the only way to do that with rust's std is to derive Debug, but this will also print out the variant's fields. This creates the unfortunate situation where we need to manually write out each variant's string name (ex: in #1963), which is both boilerplate-ey and error-prone. Crates such as `strum` exist for this reason, but it includes a lot of code and complexity that we don't need. This adds a dead-simple `EnumVariantMeta` derive that exposes `enum_variant_index` and `enum_variant_name` functions. This allows us to make cases like #1963 much cleaner (see the second commit). We might also be able to reuse this logic for `bevy_reflect` enum derives.
24 lines
782 B
TOML
24 lines
782 B
TOML
[package]
|
|
name = "bevy_utils"
|
|
version = "0.5.0"
|
|
edition = "2018"
|
|
authors = [
|
|
"Bevy Contributors <bevyengine@gmail.com>",
|
|
"Carter Anderson <mcanders1@gmail.com>",
|
|
]
|
|
description = "A collection of utils for Bevy Engine"
|
|
homepage = "https://bevyengine.org"
|
|
repository = "https://github.com/bevyengine/bevy"
|
|
license = "MIT"
|
|
keywords = ["bevy"]
|
|
|
|
[dependencies]
|
|
bevy_derive = { path = "../bevy_derive", version = "0.5.0" }
|
|
ahash = "0.7.0"
|
|
tracing = {version = "0.1", features = ["release_max_level_info"]}
|
|
instant = { version = "0.1", features = ["wasm-bindgen"] }
|
|
uuid = { version = "0.8", features = ["v4", "serde"] }
|
|
|
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
|
getrandom = {version = "0.2.0", features = ["js"]}
|
|
uuid = { version = "0.8", features = ["wasm-bindgen"] }
|