pub trait SendUpload: Send {
// Required methods
fn write_chunk(
&mut self,
offset: u64,
reader: &mut (dyn AsyncRead + Unpin + Send),
) -> impl Future<Output = Result<u64, TusError>> + Send;
fn get_info(
&self,
) -> impl Future<Output = Result<UploadInfo, TusError>> + Send;
fn finalize(&mut self) -> impl Future<Output = Result<(), TusError>> + Send;
fn delete(self) -> impl Future<Output = Result<(), TusError>> + Send;
fn declare_length(
&mut self,
length: u64,
) -> impl Future<Output = Result<(), TusError>> + Send;
fn concatenate(
&mut self,
partials: &[UploadInfo],
) -> impl Future<Output = Result<(), TusError>> + Send;
fn read_content(
&self,
) -> impl Future<Output = Result<Box<dyn AsyncRead + Send + Unpin>, TusError>> + Send;
}Expand description
Operations on a single upload resource.
Required Methods§
Sourcefn write_chunk(
&mut self,
offset: u64,
reader: &mut (dyn AsyncRead + Unpin + Send),
) -> impl Future<Output = Result<u64, TusError>> + Send
fn write_chunk( &mut self, offset: u64, reader: &mut (dyn AsyncRead + Unpin + Send), ) -> impl Future<Output = Result<u64, TusError>> + Send
Write chunk data starting at offset, streaming from reader.
Returns the number of bytes written.
Sourcefn get_info(&self) -> impl Future<Output = Result<UploadInfo, TusError>> + Send
fn get_info(&self) -> impl Future<Output = Result<UploadInfo, TusError>> + Send
Retrieve current metadata and offset.
Sourcefn finalize(&mut self) -> impl Future<Output = Result<(), TusError>> + Send
fn finalize(&mut self) -> impl Future<Output = Result<(), TusError>> + Send
Called once all bytes have been received (offset == size).
Sourcefn delete(self) -> impl Future<Output = Result<(), TusError>> + Send
fn delete(self) -> impl Future<Output = Result<(), TusError>> + Send
Delete this upload and free all associated resources.
Called by the termination extension (DELETE). Return Err if unsupported.
Sourcefn declare_length(
&mut self,
length: u64,
) -> impl Future<Output = Result<(), TusError>> + Send
fn declare_length( &mut self, length: u64, ) -> impl Future<Output = Result<(), TusError>> + Send
Set the definitive Upload-Length on a deferred-length upload.
Called when the client provides Upload-Length on a PATCH request.
Sourcefn concatenate(
&mut self,
partials: &[UploadInfo],
) -> impl Future<Output = Result<(), TusError>> + Send
fn concatenate( &mut self, partials: &[UploadInfo], ) -> impl Future<Output = Result<(), TusError>> + Send
Assemble fully-uploaded partials (in order) into this final upload. Called by the concatenation extension.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.