Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In my case I knew when the owning Rust struct was destroyed, and it was guaranteed to be the only thing holding the element handle so I would just free the DOM node during the destruction logic.

For something more general purpose I'd probably just use a destructor (whether C++ or Rust) with the same guarantee of single-ownership of the underlying ID, and the DOM node will automatically be freed once the native handle goes out of scope.

Edit: Of course, you'd have to prohibit copies on the native side.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: