Sink
Abstract type for sinks. Values that implement the sink protocol
are instances of Sink, which can be used for type testing.
Sink is not constructible directly.
Inherits
Methods
put value
Writes a value to the sink.
Parameters
| Name | Type | Description |
|---|---|---|
value |
the value to write |
premap func
Wraps the sink so each value is transformed before it is written.
The pre prefix marks the direction: unlike Iter.map,
which transforms values on their way out, premap transforms values on their
way into the sink. A value that is both Iterable and
Sinkable — an Array, say — therefore offers
map and premap as separate methods running in opposite directions.
Parameters
| Name | Type | Description |
|---|---|---|
func |
applied to each value before it is put |
prefilter pred
Wraps the sink so only values for which pred is truthy are written.
Because each wrapper transforms values on the way in, the outermost wrapper sees a value first — the reverse of an iterator chain.
Parameters
| Name | Type | Description |
|---|---|---|
pred |
decides whether a value is written |