Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Buffer ¶
Buffer is an alternative to the Materialize method in that it keeps a cached copy of data from an underlying sequence, both for faster access and to support re-using a volatile sequence.
Unlike Materialize a buffered sequence fills it's storage as it delivers values to a client, so there is no wait when calling Buffer before using the new sequence, and an unused Buffer sequence takes up no additional memory aside from the generator itself. It's slightly slower as locks are needed to ensure multiple readers play well with the cache, as some may be updating the cache at the same time. This is not true of Materialize where every access after it's built is read-only, and can easily be parallelized.
func Lines ¶
Lines returns a sequence that produces one at a time, lines of text from the provided reader. Errors while reading will interupt processing.
This version is Volatile, meaning that you can only iterate over the input a single time, as it can't "go back" and return old lines, since none are stored.
If you need to use the lines multiple times, consider calling Materialize on the returned sequence, or wrap it with [process.Buffer].
Types ¶
This section is empty.