c_vec-rs icon indicating copy to clipboard operation
c_vec-rs copied to clipboard

Change advice for the raw pointer.

Open quadrupleslap opened this issue 8 years ago • 2 comments

Instead of using cvec.get(0).unwrap() as *const _, the user should call cvec.as_ref().as_ptr() (in my opinion. ^_^)

quadrupleslap avatar Jul 22 '17 07:07 quadrupleslap

Well, one unwrap less. But a bit more confusing. I'm not sure which is preferable in such a situation... :-/

GuillaumeGomez avatar Jul 22 '17 09:07 GuillaumeGomez

For what it's worth, it's probably less confusing for anyone who isn't familiar with C arrays, or is better acquainted with Rust's slice type.

quadrupleslap avatar Jul 22 '17 22:07 quadrupleslap