andrew-d / tinycdb-rs

Bindings to TinyCDB for Rust.
https://andrew-d.github.io/tinycdb-rs/tinycdb/index.html
5 stars 2 forks source link

Unnecessary Box? #5

Open bb010g opened 6 years ago

bb010g commented 6 years ago

Cdb::open and Cdb::new both return CdbResult<Box<Cdb>>, but I can't figure out why Box is used. All that struct holds is an integer file descriptor and a reasonably small C struct.

andrew-d commented 6 years ago

Hi there! I made it a Box since I wasn't sure whether the underlying C code was safe to move (e.g. if the ffi::cdb struct kept a self-referential pointer). If you want to give the source a read-through and confirm/deny this, I'd be interested to know what the answer is! Sadly, I don't have the time myself right now.