mirror of
https://github.com/bevyengine/bevy
synced 2024-09-20 14:32:06 +00:00
a475511f43
# Objective Currently, the `ambiguous_names` hash set in `TypeRegistry` is used to keep track of short type names that are ambiguous, and to require the use of long type names for these types. However, there's no way for the consumer of `TypeRegistry` to known whether a given call to `get_with_short_type_path()` or `get_with_short_type_path_mut()` failed because a type was not registered at all, or because the short name is ambiguous. This can be used, for example, for better error reporting to the user by an editor tool. Here's some code that uses this, from my remote protocol exploration branch: ```rust let type_registration = type_registry .get_with_type_path(component_name) .or_else(|| registry.get_with_short_type_path(component_name)) .ok_or_else(|| { if type_registry.is_ambiguous(component_name) { BrpError::ComponentAmbiguous(component_name.clone()) } else { BrpError::MissingTypeRegistration(component_name.clone()) } })? ``` ## Solution - Introduces a `is_ambiguous()` method. - Also drive-by fixes two documentation comments that had broken links. --- ## Changelog - Added a `TypeRegistry::is_ambiguous()` method, for checking whether a given short type path is ambiguous (e.g. `MyType` potentially matching either `some_crate::MyType` or `another_crate::MyType`) --------- Co-authored-by: François <mockersf@gmail.com> |
||
---|---|---|
.. | ||
bevy_a11y | ||
bevy_animation | ||
bevy_app | ||
bevy_asset | ||
bevy_audio | ||
bevy_core | ||
bevy_core_pipeline | ||
bevy_derive | ||
bevy_diagnostic | ||
bevy_dylib | ||
bevy_dynamic_plugin | ||
bevy_ecs | ||
bevy_ecs_compile_fail_tests | ||
bevy_encase_derive | ||
bevy_gilrs | ||
bevy_gizmos | ||
bevy_gltf | ||
bevy_hierarchy | ||
bevy_input | ||
bevy_internal | ||
bevy_log | ||
bevy_macro_utils | ||
bevy_macros_compile_fail_tests | ||
bevy_math | ||
bevy_mikktspace | ||
bevy_pbr | ||
bevy_ptr | ||
bevy_reflect | ||
bevy_reflect_compile_fail_tests | ||
bevy_render | ||
bevy_scene | ||
bevy_sprite | ||
bevy_tasks | ||
bevy_text | ||
bevy_time | ||
bevy_transform | ||
bevy_ui | ||
bevy_utils | ||
bevy_window | ||
bevy_winit |