Skip to content

Static Methods #151

Open
Open
@cputnam-a11y

Description

@cputnam-a11y

Are static methods in the plan for the future?

use deno_bindgen::deno_bindgen;

#[deno_bindgen]
struct Foo {
    
}
#[deno_bindgen] 
impl Foo {
    #[constructor]
    pub fn new() -> Foo {
        Self {}
    }
    pub fn bar(&self) -> String {
        "Hello from Rust!".to_string()
    }
}
#[deno_bindgen]
impl Foo {
    pub fn baz() -> String {
        "Hello from Rust!".to_string()
    }
    
}

this code produces the following error:

called `Result::unwrap()` on an `Err` value: MissingReceiver

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions