pub struct WriteEnd<Buffer, Q, Auxiliary = ()> { /* private fields */ }
Expand description
It is recommended to create at most one WriteEnd
per thread
using WriteEnd::clone
.
Implementations§
Source§impl<Buffer, Q, Auxiliary> WriteEnd<Buffer, Q, Auxiliary>
impl<Buffer, Q, Auxiliary> WriteEnd<Buffer, Q, Auxiliary>
Sourcepub fn new(shared_data: SharedData<Buffer, Q, Auxiliary>) -> Self
pub fn new(shared_data: SharedData<Buffer, Q, Auxiliary>) -> Self
Create a WriteEnd
from SharedData
.
Consume the WriteEnd
and return the stored SharedData
.
Source§impl<Buffer, Q, Auxiliary> WriteEnd<Buffer, Q, Auxiliary>
impl<Buffer, Q, Auxiliary> WriteEnd<Buffer, Q, Auxiliary>
pub fn send_open_file_request( &mut self, id: Id<Buffer>, params: OpenFileRequest<'_>, ) -> Result<AwaitableHandle<Buffer>, Error>
pub fn send_close_request( &mut self, id: Id<Buffer>, handle: Cow<'_, Handle>, ) -> Result<AwaitableStatus<Buffer>, Error>
Sourcepub fn send_read_request(
&mut self,
id: Id<Buffer>,
handle: Cow<'_, Handle>,
offset: u64,
len: u32,
buffer: Option<Buffer>,
) -> Result<AwaitableData<Buffer>, Error>
pub fn send_read_request( &mut self, id: Id<Buffer>, handle: Cow<'_, Handle>, offset: u64, len: u32, buffer: Option<Buffer>, ) -> Result<AwaitableData<Buffer>, Error>
buffer
- If set toNone
or the buffer is not long enough, thencrate::Data::AllocatedBox
will be returned.
Return crate::Data::Buffer
or
crate::Data::AllocatedBox
if not EOF, otherwise returns
crate::Data::Eof
.
pub fn send_remove_request( &mut self, id: Id<Buffer>, path: Cow<'_, Path>, ) -> Result<AwaitableStatus<Buffer>, Error>
pub fn send_rename_request( &mut self, id: Id<Buffer>, oldpath: Cow<'_, Path>, newpath: Cow<'_, Path>, ) -> Result<AwaitableStatus<Buffer>, Error>
Sourcepub fn send_mkdir_request(
&mut self,
id: Id<Buffer>,
path: Cow<'_, Path>,
attrs: FileAttrs,
) -> Result<AwaitableStatus<Buffer>, Error>
pub fn send_mkdir_request( &mut self, id: Id<Buffer>, path: Cow<'_, Path>, attrs: FileAttrs, ) -> Result<AwaitableStatus<Buffer>, Error>
attrs
-FileAttrs::get_size
must be equal toNone
.
pub fn send_rmdir_request( &mut self, id: Id<Buffer>, path: Cow<'_, Path>, ) -> Result<AwaitableStatus<Buffer>, Error>
pub fn send_opendir_request( &mut self, id: Id<Buffer>, path: Cow<'_, Path>, ) -> Result<AwaitableHandle<Buffer>, Error>
Sourcepub fn send_readdir_request(
&mut self,
id: Id<Buffer>,
handle: Cow<'_, Handle>,
) -> Result<AwaitableNameEntries<Buffer>, Error>
pub fn send_readdir_request( &mut self, id: Id<Buffer>, handle: Cow<'_, Handle>, ) -> Result<AwaitableNameEntries<Buffer>, Error>
Return entries in the directory specified by the handle
, including
.
and ..
.
The filename
only contains the basename.
NOTE that it does not return all entries in one response.
You would have to keep calling send_readdir_request
until it returns
an empty Box
.
pub fn send_stat_request( &mut self, id: Id<Buffer>, path: Cow<'_, Path>, ) -> Result<AwaitableAttrs<Buffer>, Error>
Sourcepub fn send_lstat_request(
&mut self,
id: Id<Buffer>,
path: Cow<'_, Path>,
) -> Result<AwaitableAttrs<Buffer>, Error>
pub fn send_lstat_request( &mut self, id: Id<Buffer>, path: Cow<'_, Path>, ) -> Result<AwaitableAttrs<Buffer>, Error>
Does not follow symlink
Sourcepub fn send_fstat_request(
&mut self,
id: Id<Buffer>,
handle: Cow<'_, Handle>,
) -> Result<AwaitableAttrs<Buffer>, Error>
pub fn send_fstat_request( &mut self, id: Id<Buffer>, handle: Cow<'_, Handle>, ) -> Result<AwaitableAttrs<Buffer>, Error>
handle
- Must be opened withFileMode::READ
.
pub fn send_setstat_request( &mut self, id: Id<Buffer>, path: Cow<'_, Path>, attrs: FileAttrs, ) -> Result<AwaitableStatus<Buffer>, Error>
Sourcepub fn send_fsetstat_request(
&mut self,
id: Id<Buffer>,
handle: Cow<'_, Handle>,
attrs: FileAttrs,
) -> Result<AwaitableStatus<Buffer>, Error>
pub fn send_fsetstat_request( &mut self, id: Id<Buffer>, handle: Cow<'_, Handle>, attrs: FileAttrs, ) -> Result<AwaitableStatus<Buffer>, Error>
handle
- Must be opened withOpenOptions::write
set.
pub fn send_readlink_request( &mut self, id: Id<Buffer>, path: Cow<'_, Path>, ) -> Result<AwaitableName<Buffer>, Error>
pub fn send_realpath_request( &mut self, id: Id<Buffer>, path: Cow<'_, Path>, ) -> Result<AwaitableName<Buffer>, Error>
Sourcepub fn send_symlink_request(
&mut self,
id: Id<Buffer>,
targetpath: Cow<'_, Path>,
linkpath: Cow<'_, Path>,
) -> Result<AwaitableStatus<Buffer>, Error>
pub fn send_symlink_request( &mut self, id: Id<Buffer>, targetpath: Cow<'_, Path>, linkpath: Cow<'_, Path>, ) -> Result<AwaitableStatus<Buffer>, Error>
Create symlink
Sourcepub fn send_limits_request(
&mut self,
id: Id<Buffer>,
) -> Result<AwaitableLimits<Buffer>, Error>
pub fn send_limits_request( &mut self, id: Id<Buffer>, ) -> Result<AwaitableLimits<Buffer>, Error>
Return limits of the server
§Precondition
Requires extensions::contains(Extensions::LIMITS)
to be true.
Sourcepub fn send_expand_path_request(
&mut self,
id: Id<Buffer>,
path: Cow<'_, Path>,
) -> Result<AwaitableName<Buffer>, Error>
pub fn send_expand_path_request( &mut self, id: Id<Buffer>, path: Cow<'_, Path>, ) -> Result<AwaitableName<Buffer>, Error>
This supports canonicalisation of relative paths and those that need
tilde-expansion, i.e. “”, “/…” and “~user/…”.
These paths are expanded using shell-like rules and the resultant path
is canonicalised similarly to WriteEnd::send_realpath_request
.
§Precondition
Requires extensions::contains(Extensions::EXPAND_PATH)
to be true.
Sourcepub fn send_fsync_request(
&mut self,
id: Id<Buffer>,
handle: Cow<'_, Handle>,
) -> Result<AwaitableStatus<Buffer>, Error>
pub fn send_fsync_request( &mut self, id: Id<Buffer>, handle: Cow<'_, Handle>, ) -> Result<AwaitableStatus<Buffer>, Error>
§Precondition
Requires extensions::contains(Extensions::FSYNC)
to be true.
Sourcepub fn send_hardlink_request(
&mut self,
id: Id<Buffer>,
oldpath: Cow<'_, Path>,
newpath: Cow<'_, Path>,
) -> Result<AwaitableStatus<Buffer>, Error>
pub fn send_hardlink_request( &mut self, id: Id<Buffer>, oldpath: Cow<'_, Path>, newpath: Cow<'_, Path>, ) -> Result<AwaitableStatus<Buffer>, Error>
§Precondition
Requires extensions::contains(Extensions::HARDLINK)
to be true.
Sourcepub fn send_posix_rename_request(
&mut self,
id: Id<Buffer>,
oldpath: Cow<'_, Path>,
newpath: Cow<'_, Path>,
) -> Result<AwaitableStatus<Buffer>, Error>
pub fn send_posix_rename_request( &mut self, id: Id<Buffer>, oldpath: Cow<'_, Path>, newpath: Cow<'_, Path>, ) -> Result<AwaitableStatus<Buffer>, Error>
§Precondition
Requires extensions::contains(Extensions::POSIX_RENAME)
to be true.
Sourcepub fn send_copy_data_request(
&mut self,
id: Id<Buffer>,
read_from_handle: Cow<'_, Handle>,
read_from_offset: u64,
read_data_length: u64,
write_to_handle: Cow<'_, Handle>,
write_to_offset: u64,
) -> Result<AwaitableStatus<Buffer>, Error>
pub fn send_copy_data_request( &mut self, id: Id<Buffer>, read_from_handle: Cow<'_, Handle>, read_from_offset: u64, read_data_length: u64, write_to_handle: Cow<'_, Handle>, write_to_offset: u64, ) -> Result<AwaitableStatus<Buffer>, Error>
The server MUST copy the data exactly as if the client had issued a
series of RequestInner::Read
requests on the read_from_handle
starting at read_from_offset
and totaling read_data_length
bytes,
and issued a series of RequestInner::Write
packets on the
write_to_handle
, starting at the write_from_offset
, and totaling
the total number of bytes read by the RequestInner::Read
packets.
The server SHOULD allow read_from_handle
and write_to_handle
to
be the same handle as long as the range of data is not overlapping.
This allows data to efficiently be moved within a file.
If data_length
is 0
, this imples data should be read until EOF is
encountered.
There are no protocol restictions on this operation; however, the server MUST ensure that the user does not exceed quota, etc. The server is, as always, free to complete this operation out of order if it is too large to complete immediately, or to refuse a request that is too large.
§Precondition
Requires extensions::contains(Extensions::COPY_DATA)
to be true.
For openssh-portable, this is available from V_9_0_P1.
Source§impl<Buffer, Q, Auxiliary> WriteEnd<Buffer, Q, Auxiliary>
impl<Buffer, Q, Auxiliary> WriteEnd<Buffer, Q, Auxiliary>
Sourcepub fn send_write_request_buffered(
&mut self,
id: Id<Buffer>,
handle: Cow<'_, Handle>,
offset: u64,
data: Cow<'_, [u8]>,
) -> Result<AwaitableStatus<Buffer>, Error>
pub fn send_write_request_buffered( &mut self, id: Id<Buffer>, handle: Cow<'_, Handle>, offset: u64, data: Cow<'_, [u8]>, ) -> Result<AwaitableStatus<Buffer>, Error>
Write will extend the file if writing beyond the end of the file.
It is legal to write way beyond the end of the file, the semantics are to write zeroes from the end of the file to the specified offset and then the data.
On most operating systems, such writes do not allocate disk space but instead leave “holes” in the file.
This function is only suitable for writing small data since it needs to copy the
entire data
into buffer.
Sourcepub fn send_write_request_buffered_vectored(
&mut self,
id: Id<Buffer>,
handle: Cow<'_, Handle>,
offset: u64,
io_slices: &[IoSlice<'_>],
) -> Result<AwaitableStatus<Buffer>, Error>
pub fn send_write_request_buffered_vectored( &mut self, id: Id<Buffer>, handle: Cow<'_, Handle>, offset: u64, io_slices: &[IoSlice<'_>], ) -> Result<AwaitableStatus<Buffer>, Error>
Write will extend the file if writing beyond the end of the file.
It is legal to write way beyond the end of the file, the semantics are to write zeroes from the end of the file to the specified offset and then the data.
On most operating systems, such writes do not allocate disk space but instead leave “holes” in the file.
This function is only suitable for writing small data since it needs to copy the
entire data
into buffer.
Sourcepub fn send_write_request_buffered_vectored2(
&mut self,
id: Id<Buffer>,
handle: Cow<'_, Handle>,
offset: u64,
bufs: &[&[IoSlice<'_>]],
) -> Result<AwaitableStatus<Buffer>, Error>
pub fn send_write_request_buffered_vectored2( &mut self, id: Id<Buffer>, handle: Cow<'_, Handle>, offset: u64, bufs: &[&[IoSlice<'_>]], ) -> Result<AwaitableStatus<Buffer>, Error>
Write will extend the file if writing beyond the end of the file.
It is legal to write way beyond the end of the file, the semantics are to write zeroes from the end of the file to the specified offset and then the data.
On most operating systems, such writes do not allocate disk space but instead leave “holes” in the file.
This function is only suitable for writing small data since it needs to copy the
entire data
into buffer.
Sourcepub fn send_write_request_zero_copy(
&mut self,
id: Id<Buffer>,
handle: Cow<'_, Handle>,
offset: u64,
data: &[Bytes],
) -> Result<AwaitableStatus<Buffer>, Error>
pub fn send_write_request_zero_copy( &mut self, id: Id<Buffer>, handle: Cow<'_, Handle>, offset: u64, data: &[Bytes], ) -> Result<AwaitableStatus<Buffer>, Error>
Write will extend the file if writing beyond the end of the file.
It is legal to write way beyond the end of the file, the semantics are to write zeroes from the end of the file to the specified offset and then the data.
On most operating systems, such writes do not allocate disk space but instead leave “holes” in the file.
This function is zero-copy.
Sourcepub fn send_write_request_zero_copy2(
&mut self,
id: Id<Buffer>,
handle: Cow<'_, Handle>,
offset: u64,
data_slice: &[&[Bytes]],
) -> Result<AwaitableStatus<Buffer>, Error>
pub fn send_write_request_zero_copy2( &mut self, id: Id<Buffer>, handle: Cow<'_, Handle>, offset: u64, data_slice: &[&[Bytes]], ) -> Result<AwaitableStatus<Buffer>, Error>
Write will extend the file if writing beyond the end of the file.
It is legal to write way beyond the end of the file, the semantics are to write zeroes from the end of the file to the specified offset and then the data.
On most operating systems, such writes do not allocate disk space but instead leave “holes” in the file.
This function is zero-copy.
Methods from Deref<Target = SharedData<Buffer, Q, Auxiliary>>§
Trait Implementations§
Auto Trait Implementations§
impl<Buffer, Q, Auxiliary> Freeze for WriteEnd<Buffer, Q, Auxiliary>
impl<Buffer, Q, Auxiliary = ()> !RefUnwindSafe for WriteEnd<Buffer, Q, Auxiliary>
impl<Buffer, Q, Auxiliary> Send for WriteEnd<Buffer, Q, Auxiliary>
impl<Buffer, Q, Auxiliary> Sync for WriteEnd<Buffer, Q, Auxiliary>
impl<Buffer, Q, Auxiliary> Unpin for WriteEnd<Buffer, Q, Auxiliary>
impl<Buffer, Q, Auxiliary = ()> !UnwindSafe for WriteEnd<Buffer, Q, Auxiliary>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)