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

It is recommended to create at most one WriteEnd per thread using WriteEnd::clone.

Implementations

NOTE that this merely add the request to the buffer, you need to call SharedData::flush to actually send the requests.

NOTE that this merely add the request to the buffer, you need to call SharedData::flush to actually send the requests.

Return crate::Data::Buffer or crate::Data::AllocatedBox if not EOF, otherwise returns crate::Data::Eof.

NOTE that this merely add the request to the buffer, you need to call SharedData::flush to actually send the requests.

NOTE that this merely add the request to the buffer, you need to call SharedData::flush to actually send the requests.

NOTE that this merely add the request to the buffer, you need to call SharedData::flush to actually send the requests.

NOTE that this merely add the request to the buffer, you need to call SharedData::flush to actually send the requests.

NOTE that this merely add the request to the buffer, you need to call SharedData::flush to actually send the requests.

NOTE that this merely add the request to the buffer, you need to call SharedData::flush to actually send the requests.

Return all entries in the directory specified by the handle, including . and ...

The filename only contains the basename.

NOTE that this merely add the request to the buffer, you need to call SharedData::flush to actually send the requests.

NOTE that this merely add the request to the buffer, you need to call SharedData::flush to actually send the requests.

Does not follow symlink

NOTE that this merely add the request to the buffer, you need to call SharedData::flush to actually send the requests.

  • handle - Must be opened with FileMode::READ.

NOTE that this merely add the request to the buffer, you need to call SharedData::flush to actually send the requests.

NOTE that this merely add the request to the buffer, you need to call SharedData::flush to actually send the requests.

  • handle - Must be opened with OpenOptions::write set.

NOTE that this merely add the request to the buffer, you need to call SharedData::flush to actually send the requests.

NOTE that this merely add the request to the buffer, you need to call SharedData::flush to actually send the requests.

NOTE that this merely add the request to the buffer, you need to call SharedData::flush to actually send the requests.

Create symlink

NOTE that this merely add the request to the buffer, you need to call SharedData::flush to actually send the requests.

Return limits of the server

NOTE that this merely add the request to the buffer, you need to call SharedData::flush to actually send the requests.

Precondition

Requires Extensions::limits to be true.

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.

NOTE that this merely add the request to the buffer, you need to call SharedData::flush to actually send the requests.

Precondition

Requires Extensions::expand_path to be true.

NOTE that this merely add the request to the buffer, you need to call SharedData::flush to actually send the requests.

Precondition

Requires Extensions::fsync to be true.

NOTE that this merely add the request to the buffer, you need to call SharedData::flush to actually send the requests.

Precondition

Requires Extensions::hardlink to be true.

NOTE that this merely add the request to the buffer, you need to call SharedData::flush to actually send the requests.

Precondition

Requires Extensions::posix_rename to be true.

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.

NOTE that this merely add the request to the buffer, you need to call SharedData::flush to actually send the requests.

This function is only suitable for writing small data since it needs to copy the entire data into buffer.

For writing large data, it is recommended to use WriteEnd::send_write_request_direct.

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.

NOTE that this merely add the request to the buffer, you need to call SharedData::flush to actually send the requests.

This function is only suitable for writing small data since it needs to copy the entire data into buffer.

For writing large data, it is recommended to use WriteEnd::send_write_request_direct.

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.

NOTE that this merely add the request to the buffer, you need to call SharedData::flush to actually send the requests.

This function is only suitable for writing small data since it needs to copy the entire data into buffer.

For writing large data, it is recommended to use WriteEnd::send_write_request_direct.

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.

NOTE that this merely add the request to the buffer, you need to call SharedData::flush to actually send the requests.

This function is zero-copy.

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.

NOTE that this merely add the request to the buffer, you need to call SharedData::flush to actually send the requests.

This function is zero-copy.

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 sends write requests directly, without any buffering, thus it is not cancel safe.

Cancel Safety

This function is only cancel safe if the data is no more than 1024 long.

Otherwise it is not cancel safe, dropping the future returned might cause the data to paritaly written, and thus the sftp-server might demonstrate undefined behavior.

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 sends vectored write requests directly, without any buffering, thus it is not cancel safe.

Cancel Safety

This function is only cancel safe if the data is no more than 1024 long.

Otherwise it is not cancel safe, dropping the future returned might cause the data to paritaly written, and thus the sftp-server might demonstrate undefined behavior.

Methods from Deref<Target = SharedData<Buffer, Auxiliary>>

SharedData is a newtype wrapper for Arc<SharedDataInner>, so this function returns how many Arc there are that referred to the shared data.

Create a useable response id.

Return true if reserve succeeds, false otherwise.

Return true if reserve succeeds, false otherwise.

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.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

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 resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

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.