In nearly every case that I've encountered personally while using Sodium, whenever I have a Result or an Option, or even a boolean filter that I want to apply to a Stream, I almost always want to actually split the Stream based on that criteria.
In order to provide robust error handling and responsiveness, you want to respond to all inputs, even if they're invalid.
This means that instead of the various filter methods returning a single Stream, they should actually return a pair of Stream. My enum dispatching idea is basically addressing the same idea.
In nearly every case that I've encountered personally while using Sodium, whenever I have a
Result
or anOption
, or even a boolean filter that I want to apply to aStream
, I almost always want to actually split theStream
based on that criteria.In order to provide robust error handling and responsiveness, you want to respond to all inputs, even if they're invalid.
This means that instead of the various
filter
methods returning a singleStream
, they should actually return a pair ofStream
. My enum dispatching idea is basically addressing the same idea.