gadomski / las-rs

Read and write ASPRS las files, Rust edition.
MIT License
73 stars 32 forks source link

Add Reader and Writer traits. Rename existing structs with Std prefix. #20

Closed lkolbly closed 5 years ago

lkolbly commented 5 years ago

Fixes #19

Chose the Std prefix to indicate that those implementations leverage the std library (std::io::Write, Seek, etc.). Maintained the separation between Reader and Writer, so there is no single LasFile class.

The Writer trait does not include close(). A flush() may be appropriate, but close() has more finality and may not represent all cases (for example, you may want to flush for now, but keep the writer open in case more points come in).

gadomski commented 5 years ago

This looks good. The only thing I'm not sure about is the naming. Since we have structs called Header and Builder floating around, it feels a bit out to have Writer be a trait, at least on first blush. Do you have any objections to changing the trait to Write and keeping the struct as Writer (and same for the read side)? How does that scan to you?

lkolbly commented 5 years ago

That scans, std::io::Write lacks the R as well, so it'd be fitting in with that. I'll update the PR this evening.