Trait RustCallable
pub trait RustCallable:
'static
+ PartialEq
+ Hash
+ Display
+ Send
+ Sync {
// Required method
fn invoke(&mut self, args: &[&Variant]) -> Result<Variant, ()>;
// Provided method
fn is_valid(&self) -> bool { ... }
}
Expand description
Represents a custom callable object defined in Rust.
This trait has a single method, invoke
, which is called upon invocation.
Since callables can be invoked from anywhere, they must be self-contained ('static
) and thread-safe (Send + Sync
).
They also should implement Display
for the Godot string representation.
Furthermore, Hash
is required for usage as a key in a Dictionary
and for checking signal connections –
Godot considers a custom callable to be connected to a signal if a callable with the same hash is already connected to that signal.
Finally, PartialEq
is necessary for equality checks.
Required Methods§
Provided Methods§
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.