Ideomatic Rust to storing/freeing externally allocated memory as a ref
An external C library allocates/frees memory via FFI. My rust code is a thin wrapper layer called by C, and allows other Rust developers to write safe Rust code without dealing with FFI from C. My layer needs to hold a reference to C-allocated object and do the Drop when requested by C code to cleanup. What would be the idiomatic way to store a reference to that struct and later free it in this case?
Ideomatic Rust to storing/freeing externally allocated memory as a ref
An external C library allocates/frees memory via FFI. My rust code is a thin wrapper layer called by C, and allows other Rust developers to write safe Rust code without dealing with FFI from C. My layer needs to hold a reference to C-allocated object and do the Drop when requested by C code to cleanup. What would be the idiomatic way to store a reference to that struct and later free it in this case?
Ideomatic Rust to storing/freeing externally allocated memory as a ref
An external C library allocates/frees memory via FFI. My rust code is a thin wrapper layer called by C, and allows other Rust developers to write safe Rust code without dealing with FFI from C. My layer needs to hold a reference to C-allocated object and do the Drop when requested by C code to cleanup. What would be the idiomatic way to store a reference to that struct and later free it in this case?
Ideomatic Rust to storing/freeing externally allocated memory as a ref
An external C library allocates/frees memory via FFI. My rust code is a thin wrapper layer called by C, and allows other Rust developers to write safe Rust code without dealing with FFI from C. My layer needs to hold a reference to C-allocated object and do the Drop when requested by C code to cleanup. What would be the idiomatic way to store a reference to that struct and later free it in this case?
Ideomatic Rust to storing/freeing externally allocated memory as a ref
An external C library allocates/frees memory via FFI. My rust code is a thin wrapper layer called by C, and allows other Rust developers to write safe Rust code without dealing with FFI from C. My layer needs to hold a reference to C-allocated object and do the Drop when requested by C code to cleanup. What would be the idiomatic way to store a reference to that struct and later free it in this case?