Writing an iterator to a Writer


#1

I have an iterator and I skip a certain amount of elements. I want to write the resulting iterator to a Writer. I have tried using io:copy or looking for method in writer that can take an iterator.

Is there an ergonomic and efficient way to do it that does not involve collecting the iterator first?


#2

I think that a for loop will be ergonomic and efficient here. There is no bridge between iterators and writers in the stdlib. Of course you can implement it yourself as an extension trait.