Commit graph

3 commits

Author SHA1 Message Date
polyphemus
b1c2d7ac7c Rewrite cut_bytes()
Do no longer iterate over each byte and instead rely on the Buffer trait
to find the newline for us. Iterate over the ranges to specify slices of
the line which need to be printed out.

This rewrite gives a signifcant performance increase:
Old:    1.32s
mahkoh: 0.90s
New:    0.20s
GNU:    0.15s
2014-06-27 17:39:49 +02:00
polyphemus
8b1ff08bd5 Add cut_characters implementation, based on cut_bytes
This implementation uses rust's concept of characters and fails if the
input isn't valid utf-8. GNU cut implements '--characters' as an alias
for '--bytes' and thus has different semantics, for this option, from
this implemtation.
2014-06-27 17:39:49 +02:00
polyphemus
2ab586459b Add initial cut support, only bytes cutting 2014-06-27 17:39:41 +02:00