Struct openssh_sftp_client::SharedData
source · [−]pub struct SharedData<Buffer, Auxiliary = ()>(_);
Expand description
SharedData contains both the writer and the responses because:
- The overhead of
Arc
and a separate allocation; - If the write end of a connection is closed, then openssh implementation of sftp-server would close the read end right away, discarding any unsent but processed or unprocessed responses.
Implementations
sourceimpl<Buffer, Auxiliary> SharedData<Buffer, Auxiliary>
impl<Buffer, Auxiliary> SharedData<Buffer, Auxiliary>
sourcepub fn strong_count(&self) -> usize
pub fn strong_count(&self) -> usize
SharedData
is a newtype wrapper for Arc<SharedDataInner>
,
so this function returns how many Arc
there are that referred
to the shared data.
pub fn get_auxiliary(&self) -> &Auxiliary
pub fn get_auxiliary_mut(&mut self) -> Option<&mut Auxiliary>
sourceimpl<Buffer: Send + Sync, Auxiliary> SharedData<Buffer, Auxiliary>
impl<Buffer: Send + Sync, Auxiliary> SharedData<Buffer, Auxiliary>
sourcepub fn create_response_id(&self) -> Id<Buffer>
pub fn create_response_id(&self) -> Id<Buffer>
Create a useable response id.
sourcepub fn try_reserve_id(&self, new_id_cnt: u32) -> bool
pub fn try_reserve_id(&self, new_id_cnt: u32) -> bool
Return true if reserve succeeds, false otherwise.
sourcepub fn reserve_id(&self, new_id_cnt: u32)
pub fn reserve_id(&self, new_id_cnt: u32)
Return true if reserve succeeds, false otherwise.
sourcepub async fn try_flush(&self) -> Result<bool, Error>
pub async fn try_flush(&self) -> Result<bool, Error>
Flush the write buffer.
If another thread is flushing, then Ok(false)
will be returned.
Cancel Safety
This function is only cancel safe if WriteEnd::send_write_request_direct
or
WriteEnd::send_write_request_direct_vectored
is not called when this
future is cancelled.
Upon cancel, it might only partially flushed out the data, which can be restarted by another thread.
However, if WriteEnd::send_write_request_direct
or
WriteEnd::send_write_request_direct_vectored
is called, then the write data
will be interleaved and thus produce undefined behavior.
sourcepub async fn flush(&self) -> Result<(), Error>
pub async fn flush(&self) -> Result<(), Error>
Flush the write buffer.
If another thread is flushing, then this function would wait until the other thread is done.
Cancel Safety
This function is only cancel safe if WriteEnd::send_write_request_direct
or
WriteEnd::send_write_request_direct_vectored
is not called when this
future is cancelled.
Upon cancel, it might only partially flushed out the data, which can be restarted by another thread.
However, if WriteEnd::send_write_request_direct
or
WriteEnd::send_write_request_direct_vectored
is called, then the write data
will be interleaved and thus produce undefined behavior.
Trait Implementations
sourceimpl<Buffer, Auxiliary> Clone for SharedData<Buffer, Auxiliary>
impl<Buffer, Auxiliary> Clone for SharedData<Buffer, Auxiliary>
sourceimpl<Buffer: Debug, Auxiliary: Debug> Debug for SharedData<Buffer, Auxiliary>
impl<Buffer: Debug, Auxiliary: Debug> Debug for SharedData<Buffer, Auxiliary>
Auto Trait Implementations
impl<Buffer, Auxiliary = ()> !RefUnwindSafe for SharedData<Buffer, Auxiliary>
impl<Buffer, Auxiliary> Send for SharedData<Buffer, Auxiliary> where
Auxiliary: Send + Sync,
Buffer: Send,
impl<Buffer, Auxiliary> Sync for SharedData<Buffer, Auxiliary> where
Auxiliary: Send + Sync,
Buffer: Send,
impl<Buffer, Auxiliary> Unpin for SharedData<Buffer, Auxiliary>
impl<Buffer, Auxiliary = ()> !UnwindSafe for SharedData<Buffer, Auxiliary>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more