Skip to main content
pub trait FileUploadListener: Send + Sync 
    // Required methods
    fn on_multi_part_upload_complete(&self, results: Vec<OperationResult>);
fn on_part_upload(&self, result: OperationResult);
fn on_full_file_upload(&self, result: OperationResult);

    // Provided method
    fn on_multi_part_upload_cancel(&self, results: Vec<OperationResult>) …

Listener trait for file upload progress callbacks.

Implement this trait to receive notifications about upload progress, including per-part completion for multi-part uploads.

Example

Required Methods

Called when all parts of a multi-part upload have been completed.

The list holds a result for every stage of the job, in order: the initiating stage, one per uploaded part, and the completing stage. Only the completing stage names the uploaded file in full_file_names. Use upload_info to tell the stages apart.

  • results - List of results for each stage of the upload

Called whenever a single part of a multi-part upload has been completed.

This is useful for tracking progress during large file uploads. It is called for the data parts only, not for the initiating or completing stages.

  • result - Result of the part upload

Called for each batch of whole files sent in one request, as it finishes, and for each file that could not be read to be sent.

For a batch sent, full_file_names lists its files and file_name is empty; if the request failed, successful is false and error_message says why. For a file that could not be read, file_name is its local name and error_message says why.

  • result - Result of the upload operation

Provided Methods

Called when a multi-part upload was aborted because one of its stages failed after it had been initiated.

The list holds a result for every stage that completed before the failure, followed by the cancelling stage. It is informational only: the failure is also reported in the upload’s returned error. Not called when the cancel request itself fails. By default it does nothing.

  • results - List of results for each stage, ending with the cancel

Dyn Compatibility

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called “object safety”.

Implementors