Cannot connect the 'body_entered' signal (Rust/GDNative)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By CosmoXD

Hello, I was trying to connect the signal “body_entered” to a function in the same struct but i can’t do that because i get the following error:

the trait bound `&mut SpeedArea: AsArg<gdnative::prelude::Object>` is not satisfied
the trait `AsArg<gdnative::prelude::Object>` is not implemented for `&mut SpeedArea`

This is my code:

use gdnative::{prelude::*, api::Area2D, api::PhysicsBody2D};

pub struct SpeedArea {}

impl SpeedArea {
    pub fn new(_owner: &Area2D) -> Self {
        Self {}

    fn _ready(&mut self, owner: &Area2D) {
        owner.connect("body_entered", owner, "destroy_node", VariantArray::new_shared(), 0).unwrap();

    fn destroy_node(&mut self, owner: &Area2D, body: Ref<PhysicsBody2D>) {

:bust_in_silhouette: Reply From: CosmoXD

The “owner” type was bad, It should be a Ref<Area2D> or a TRef<Area2D>