pub struct ReadEnd<Buffer, Auxiliary = ()> { /* private fields */ }

Implementations

Precondition: ReadEnd::wait_for_new_request must not be 0.

Restart on Error

Only when the returned error is Error::InvalidResponseId or Error::AwaitableError, can the function be restarted.

Upon other errors Error::IOError, Error::FormatError and Error::RecursiveErrors, the sftp session has to be discarded.

Example
let readend = ...;
loop {
    let new_requests_submit = readend.wait_for_new_request().await;
    if new_requests_submit == 0 {
        break;
    }

    // If attempt to read in more than new_requests_submit, then
    // `read_in_one_packet` might block forever.
    for _ in 0..new_requests_submit {
        readend.read_in_one_packet().await.unwrap();
    }
}
Cancel Safety

This function is not cancel safe.

Dropping the future might cause the response packet to be partially read, and the next read would treat the partial response as a new response.

Return number of requests sent (including requests that are still in the write buffer and not yet flushed) and number of responses to read in. Read 0 if the connection is closed.

You must call this function in a loop, break if this function returns 0, otherwise call ReadEnd::read_in_one_packet for n times where n in the return value of this function, then repeat.

Cancel Safety

It is perfectly safe to cancel this future.

Forward function call to SharedData::try_flush.

Forward function call to SharedData::flush.

Wait for next packet to be readable.

Return Ok(()) if next packet is ready and readable, Error::IOError(io_error) where io_error.kind() == ErrorKind::UnexpectedEof if EOF is met.

Cancel Safety

This function is cancel safe and thus can be used with tokio::select! to implement ReadEnd::flush_write_end_buffer on timeout.

Trait Implementations

Formats the value using the given formatter. Read more

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

Performs the conversion.

Performs the conversion.

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.