bschwind / opencascade-rs

Rust bindings to the OpenCascade CAD Kernel
GNU Lesser General Public License v2.1
118 stars 22 forks source link

Should we be using cxx-rs shared_ptr instead of unique_ptr? #126

Open bschwind opened 1 year ago

bschwind commented 1 year ago

This is more of an open question. Right now the higher level abstractions use a UniquePtr to hold a reference to the inner FFI types for opencascade.

This works, but then it becomes harder to clone and use shapes in multiple contexts. I'm not sure yet if we desire that functionality, but maybe shared_ptr makes more sense for holding those FFI pointers.

I can imagine scenarios where we'd want to store references to intermediate shapes that are created, perhaps stored in multiple parts of the model code that get referenced later when building new shapes on top of them. shared_ptr might be better suited to a scenario like that.