Stream.run
You're seeing just the function
run
, go back to Stream module for more information.
Specs
run(Enumerable.t()) :: :ok
Runs the given stream.
This is useful when a stream needs to be run, for side effects, and there is no interest in its return result.
Examples
Open up a file, replace all #
by %
and stream to another file
without loading the whole file in memory:
File.stream!("/path/to/file")
|> Stream.map(&String.replace(&1, "#", "%"))
|> Stream.into(File.stream!("/path/to/other/file"))
|> Stream.run()
No computation will be done until we call one of the Enum
functions
or run/1
.