pub struct Lines<OutgoingSink, IncomingStream> {
pub outgoing: OutgoingSink,
pub incoming: IncomingStream,
}Expand description
A component that communicates over line streams.
Lines implements the Component trait for any pair of line-based streams
(a Stream<Item = io::Result<String>> for incoming and a Sink<String> for outgoing),
handling serialization of JSON-RPC messages to/from newline-delimited JSON.
This is a lower-level primitive than ByteStreams that enables interception and
transformation of individual lines before they are parsed or after they are serialized.
This is particularly useful for debugging, logging, or implementing custom line-based
protocols.
§Use Cases
- Line-by-line logging: Intercept and log each line before parsing
- Custom protocols: Transform lines before/after JSON-RPC processing
- Debugging: Inspect raw message strings
- Line filtering: Skip or modify specific messages
Most users should use ByteStreams instead, which provides a simpler interface
for byte-based I/O.
Fields§
§outgoing: OutgoingSinkOutgoing line sink (where we write serialized JSON-RPC messages)
incoming: IncomingStreamIncoming line stream (where we read and parse JSON-RPC messages)