lib: modify lib/pipeline to work on collection instead of iterators.

Signed-off-by: Jean Privat <jean@pryen.org>