Make sinks, sources, and pipelines generic on their errors #66
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implementation of #29.
PipelineError
becomes generic:PipelineError<SrcErr: SourceError, SnkErr: SinkError>
SourceError
andSinkError
marker traits which the respective errors must implement. This is a slight workaround becausePipelineError<SrcErr: Error, SnkErr: Error>
doesn't work (I tried, the type system doesn't like it), but it doesn't harm ergonomics too much.Error
types on theSink
,BatchSink
, andSource
traits, with bounds on the respectiveSinkError
andSourceError
traits.CommonSourceError
type which encodes the common error variants implemented in the pipeline/source glue code, rather than the ones defined by the individual source/sink types.InfallibleSourceError
andInfallibleSinkError
and implement theSourceError
andSinkError
traits on them. This saves making your own useless error types when implementing sinks and sources that don't error.Something remarkable with this (which even surprised me when I wrote it!) is that while this is a breaking API change, it doesn't require any change of the typical downstream code, as illustrated by this PR not changing anything in the
replicator
crate. Type inference takes care of it.