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

> but five function calls (from_ptr, from_utf8, to_bytes, unwrap, to_string) just to convert a C string to a Rust string seems like an excessive amount of ceremony

Well, only the first four are really needed. The last one turns it into a local, growable copy. The rest should probably get a convenience wrapper, though.

> the libxls API has an array-of-structs in a few places [...]; because Rust doesn’t believe in pointer arithmetic, I found myself manually writing the pointer arithmetic logic

Forgive me if I'm being stupid, but can't you just use slice.from_raw_parts?

https://doc.rust-lang.org/std/slice/fn.from_raw_parts.html

> writing things in a pseudo-functional, lots-of-chained-method-calls style, for which Rust is not all that well-designed

If this is about speed, then see the other comments. But if this is for another reason, what reason is it? Personally this style of programming suits Rust beautifully.



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

Search: