Trait gdnative_bindings::utils::NodeResolveExt
source · pub trait NodeResolveExt<P: Into<NodePath>> {
unsafe fn get_node_as<'a, T>(&self, path: P) -> Option<TRef<'a, T>>
where
T: SubClass<Node>;
unsafe fn get_node_as_instance<'a, T>(
&self,
path: P
) -> Option<TInstance<'a, T>>
where
T: NativeClass,
T::Base: SubClass<Node>,
{ ... }
}
Required Methods§
sourceunsafe fn get_node_as<'a, T>(&self, path: P) -> Option<TRef<'a, T>>where
T: SubClass<Node>,
unsafe fn get_node_as<'a, T>(&self, path: P) -> Option<TRef<'a, T>>where
T: SubClass<Node>,
Convenience method to obtain a reference to a node at path
relative to self
,
and cast it to the desired type. Returns None
if the node does not exist or is
not of the correct type.
Safety
This method accesses the scene tree. As a result, any calls to this function must
follow the official thread-safety guidelines. assume_safe
invariants must be observed for the resulting node during 'a
, if any.
Provided Methods§
sourceunsafe fn get_node_as_instance<'a, T>(&self, path: P) -> Option<TInstance<'a, T>>where
T: NativeClass,
T::Base: SubClass<Node>,
unsafe fn get_node_as_instance<'a, T>(&self, path: P) -> Option<TInstance<'a, T>>where
T: NativeClass,
T::Base: SubClass<Node>,
Convenience method to obtain a reference to a node at path
relative to self
,
and cast it to an instance of the desired NativeClass
type. Returns None
if
the node does not exist or is not of the correct type.
Safety
This method accesses the scene tree. As a result, any calls to this function must
follow the official thread-safety guidelines. assume_safe
invariants must be observed for the resulting node during 'a
, if any.