pub struct Lines(/* private fields */);Expand description
The caller’s side of a line queue, which yields each line of the stream without its end byte as the run reads it. Dropping it tells the run that nobody reads the lines, and the run reads the rest of the stream and drops it.
Implementations§
Source§impl Lines
impl Lines
Sourcepub fn recv(&self) -> Option<Vec<u8>>
pub fn recv(&self) -> Option<Vec<u8>>
Waits for the next line and returns it, or returns None once the
run has ended and every queued line has been returned.
Sourcepub fn recv_timeout(&self, timeout: Duration) -> Result<Option<Vec<u8>>, Silent>
pub fn recv_timeout(&self, timeout: Duration) -> Result<Option<Vec<u8>>, Silent>
Waits at most timeout for the next line, as Lines::recv does.
§Errors
Returns Silent when no line arrived and the run did not end
within timeout.
Sourcepub fn lost(&self) -> Option<Vec<u8>>
pub fn lost(&self) -> Option<Vec<u8>>
Returns the last line that a full queue dropped, after the run began
to stop or half of the run’s drain grace passed since the reap, so
Lines::recv never returned it. It is the stream’s last line when
the reader reached the end of the pipe, which it does in the other
half of the grace. Three cases leave it as another line. A process
outside the child’s group that holds the pipe open and goes on
writing, or a reader too slow to reach the end, leaves it as the last
line read when the reads ended, which can be part of a line. A stream
over its limit stops pushing lines while the reader goes on, so it is
the last line dropped before the limit, and
Captured::over_limit shows that
case. A line queued after the last drop clears it, so None does not
show that no line was dropped. It returns None until the run has
ended, and the line only once.