Skip to content

Commit 36050de

Browse files
author
toasteater
committed
Impl NodeExt for TRef
It appears that deref coercion does not cover `TRef`, causing "method not found" errors when calling `get_node_as` directly on `TRef`. Adding an impl should fix the issue.
1 parent 0d4beec commit 36050de

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

gdnative-bindings/src/utils.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,12 @@ impl<'n, N: SubClass<Node>> NodeExt for &'n N {
7575
self.upcast().get_node(path)?.assume_safe().cast()
7676
}
7777
}
78+
79+
impl<'n, N: SubClass<Node>> NodeExt for TRef<'n, N> {
80+
unsafe fn get_node_as<'a, T>(&self, path: &str) -> Option<TRef<'a, T>>
81+
where
82+
T: SubClass<Node>,
83+
{
84+
self.as_ref().get_node_as(path)
85+
}
86+
}

0 commit comments

Comments
 (0)