Trait Method

Source
pub trait Method<C: NativeClass>:
    Send
    + Sync
    + 'static {
    // Required method
    fn call(&self, this: TInstance<'_, C>, args: Varargs<'_>) -> Variant;

    // Provided method
    fn site() -> Option<Site<'static>> { ... }
}
Expand description

Safe low-level trait for stateful, variadic methods that can be called on a native script type.

Required Methods§

Source

fn call(&self, this: TInstance<'_, C>, args: Varargs<'_>) -> Variant

Calls the method on this with args.

Provided Methods§

Source

fn site() -> Option<Site<'static>>

Returns an optional site where this method is defined. Used for logging errors in FFI wrappers.

Default implementation returns None.

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§