[rust-dev] CSV implementation

Grahame Bowland grahame at angrygoats.net
Tue Jan 10 08:55:56 PST 2012

Hi everyone

I've written a CSV reader in Rust. I thought it might be interesting to
some of you to see what a day-3 rust programmer comes up with. The code is

It's quite slow - it takes my machine 0.37 seconds to parse a 200kb CSV
file. Oddly if I take the print statements on lines 119:122 out, it takes
longer - 0.48 seconds. I'm timing with stdout redirected to /dev/null.

I get four warnings like this:
csv.rs:46:30: 46:31 warning: inserting an implicit copy for type [char]
csv.rs:46                         field(x) {
I can understand the need for an implicit copy when I pass 'x' to
str::from_chars. However, in the 'inquote' alt branch the copy seems to be
triggered by the access to 'st.quote'. I don't understand why this causes a
copy to happen - could this be a bug?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20120111/3170314d/attachment.html>

More information about the Rust-dev mailing list