We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eaff3ec commit 1c2efdbCopy full SHA for 1c2efdb
crates/bevy_mod_scripting_core/src/bindings/function/namespace.rs
@@ -63,13 +63,20 @@ pub enum Namespace {
63
OnType(TypeId),
64
}
65
66
+/// A type which implements [`IntoNamespace`] by always converting to the global namespace
67
+pub struct GlobalNamespace;
68
+
69
pub trait IntoNamespace {
70
fn into_namespace() -> Namespace;
71
72
73
impl<T: ?Sized + 'static> IntoNamespace for T {
74
fn into_namespace() -> Namespace {
- Namespace::OnType(TypeId::of::<T>())
75
+ if TypeId::of::<T>() == TypeId::of::<GlobalNamespace>() {
76
+ Namespace::Global
77
+ } else {
78
+ Namespace::OnType(TypeId::of::<T>())
79
+ }
80
81
82
0 commit comments