d-unsed / ruru

Native Ruby extensions written in Rust
MIT License
832 stars 40 forks source link

Add method for Class.allocate #83

Open danielpclark opened 6 years ago

danielpclark commented 6 years ago

Currently to do allocate I have to do this:

let mut pathname_instance = Class::from(
    Class::from_existing("Pathname").send("allocate", None).value()
);

I would much prefer

let mut pathname_instance = Class::from_existing("Pathname").allocate();

I've searched Ruby's C code and couldn't find anywhere where allocate is defined. So I'm at a loss on how to add it directly.