pub struct StreamingPeekableIter<T> { /* private fields */ }
Expand description

Read pack lines one after another, without consuming more than needed from the underlying Read. Flush lines cause the reader to stop producing lines forever, leaving Read at the start of whatever comes next.

This implementation tries hard not to allocate at all which leads to quite some added complexity and plenty of extra memory copies.

Implementations

Non-IO methods

Read a packet line into the internal buffer and return it.

Returns None if the end of iteration is reached because of one of the following:

  • natural EOF
  • ERR packet line encountered if fail_on_err_lines() is true.
  • A delimiter packet line encountered

Peek the next packet line without consuming it.

Multiple calls to peek will return the same packet line, if there is one.

Return this instance as implementor of Read assuming side bands to be used in all received packet lines. Each invocation of read_line() returns a packet line.

Progress or error information will be passed to the given handle_progress(is_error, text) function, with is_error: bool being true in case the text is to be interpreted as error.

Please note that side bands need to be negotiated with the server.

Same as as_read_with_sidebands(…), but for channels without side band support.

The type parameter F needs to be configured for this method to be callable using the ‘turbofish’ operator. Use as_read().

Same as as_read_with_sidebands(…), but for channels without side band support.

Due to the preconfigured function type this method can be called without ‘turbofish’.

Return a new instance from read which will stop decoding packet lines when receiving one of the given delimiters.

Modify the peek buffer, overwriting the byte at position with the given byte to replace_with while truncating it to contain only bytes until the newly replaced position.

This is useful if you would want to remove ‘special bytes’ hidden behind, say a NULL byte to disappear and allow standard line readers to read the next line as usual.

Note that position does not include the 4 bytes prefix (they are invisible outside the reader)

Returns the packet line that stopped the iteration, or None if the end wasn’t reached yet, on EOF, or if fail_on_err_lines() was true.

Reset all iteration state allowing to continue a stopped iteration that is not yet at EOF.

This can happen once a delimiter is reached.

Similar to reset() with support to changing the delimiters.

If value is true the provider will check for special ERR packet lines and stop iteration when one is encountered.

Use [stopped_at()]StreamingPeekableIter::stopped_at() to inspect the cause of the end of the iteration. ne

Replace the reader used with the given read, resetting all other iteration state as well.

Return the inner read

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.