EmbarkStudios / mirror-mirror

🪞 Powerful reflection library for Rust
Apache License 2.0
79 stars 2 forks source link

Add `has_default_value` method to type descriptors #104

Closed davidpdrsn closed 1 year ago

davidpdrsn commented 1 year ago

We have a few places in our UI where we create a default value of some type when you click a button. This makes it cheaper to check if a type even has a default value, so you can show that in the UI before the user even clicks the button.

Previously your only option was to .default_value().is_some() which would build the whole data structure and likely do a bunch of allocations.