Skip to content

#[derive(NativeClass)] does not support struct lifetimes #174

Closed
@WBosonic

Description

@WBosonic

When using lifetime parameters in a struct, I get these errors:

missing lifetime specifier at the declaration of the struct
and
use of undeclared lifetime name 'a at the impl block

minimal example:

#[macro_use]
extern crate gdnative

#[derive(gdnative::NativeClass)]
#[inherit(gdnative::Node)]
struct Test<'a> {
    this_is_a_reference: &'a i32,
}

#[methods]
impl<'a> Test<'a> {
    fn _init(_owner: gdnative::Node) -> Self {
        Test {
            this_is_a_reference: &1
        }
    }
}

Without the macros it works fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugc: exportComponent: export (mod export, derive)

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions