Trait NodeResolveExt

Source
pub trait NodeResolveExt<P: Into<NodePath>> {
    // Required method
    unsafe fn get_node_as<'a, T>(&self, path: P) -> Option<TRef<'a, T>>
       where T: SubClass<Node>;

    // Provided method
    unsafe fn get_node_as_instance<'a, T>(
        &self,
        path: P,
    ) -> Option<TInstance<'a, T>>
       where T: NativeClass,
             T::Base: SubClass<Node> { ... }
}

Required Methods§

Source

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§

Source

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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§