Struct openssh_sftp_client_lowlevel::ReadEnd
source · [−]pub struct ReadEnd<R, Buffer, Auxiliary = ()> { /* private fields */ }
Expand description
The ReadEnd for the lowlevel API.
Implementations
sourceimpl<R: AsyncRead, Buffer: ToBuffer + 'static + Send + Sync, Auxiliary> ReadEnd<R, Buffer, Auxiliary>
impl<R: AsyncRead, Buffer: ToBuffer + 'static + Send + Sync, Auxiliary> ReadEnd<R, Buffer, Auxiliary>
sourcepub async fn receive_server_hello_pinned(
self: Pin<&mut Self>
) -> Result<Extensions, Error>
pub async fn receive_server_hello_pinned(
self: Pin<&mut Self>
) -> Result<Extensions, Error>
Must be called once right after super::connect
to receive the hello message from the server.
sourcepub async fn read_in_one_packet_pinned(
self: Pin<&mut Self>
) -> Result<(), Error>
pub async fn read_in_one_packet_pinned(
self: Pin<&mut Self>
) -> Result<(), Error>
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.
sourcepub async fn ready_for_read_pinned(self: Pin<&mut Self>) -> Result<(), Error>
pub async fn ready_for_read_pinned(self: Pin<&mut Self>) -> Result<(), Error>
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.
sourceimpl<R: AsyncRead, Buffer: ToBuffer + 'static + Send + Sync, Auxiliary> ReadEnd<R, Buffer, Auxiliary> where
Self: Unpin,
impl<R: AsyncRead, Buffer: ToBuffer + 'static + Send + Sync, Auxiliary> ReadEnd<R, Buffer, Auxiliary> where
Self: Unpin,
sourcepub async fn receive_server_hello(&mut self) -> Result<Extensions, Error>
pub async fn receive_server_hello(&mut self) -> Result<Extensions, Error>
Must be called once right after super::connect
to receive the hello message from the server.
sourcepub async fn read_in_one_packet(&mut self) -> Result<(), Error>
pub async fn read_in_one_packet(&mut self) -> Result<(), Error>
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.
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.
sourcepub async fn ready_for_read(&mut self) -> Result<(), Error>
pub async fn ready_for_read(&mut self) -> Result<(), Error>
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.
sourceimpl<R, Buffer, Auxiliary> ReadEnd<R, Buffer, Auxiliary>
impl<R, Buffer, Auxiliary> ReadEnd<R, Buffer, Auxiliary>
Return the SharedData
held by ReadEnd
.
Trait Implementations
impl<'pin, R, Buffer, Auxiliary> Unpin for ReadEnd<R, Buffer, Auxiliary> where
__ReadEnd<'pin, R, Buffer, Auxiliary>: Unpin,
Auto Trait Implementations
impl<R, Buffer, Auxiliary = ()> !RefUnwindSafe for ReadEnd<R, Buffer, Auxiliary>
impl<R, Buffer, Auxiliary> Send for ReadEnd<R, Buffer, Auxiliary> where
Auxiliary: Send + Sync,
Buffer: Send,
R: Send,
impl<R, Buffer, Auxiliary> Sync for ReadEnd<R, Buffer, Auxiliary> where
Auxiliary: Send + Sync,
Buffer: Send,
R: Sync,
impl<R, Buffer, Auxiliary = ()> !UnwindSafe for ReadEnd<R, Buffer, Auxiliary>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more