Skip to content

Implement Native JSClasses #113

@yancheng199287

Description

@yancheng199287

I want to add struct,like this:

struct User {
    username: String,
    email: String,
    sign_in_count: u64,
    active: bool,
}

fn build_user(email: String, username: String) -> User {
    User {
        email,
        username,
        active: true,
        sign_in_count: 1,
    }
}

impl User{
    
    fn introduce(self){
        println!("{} {}",self.username,self.email)
    }
}

and I want to use User in JS , like this

let user=new User("Jason","xxxxx@gmail.com",false,10);
user.introduce();

how to do it? thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions