Skip to main content

Upload

Struct Upload 

Source
pub struct Upload { /* private fields */ }
Expand description

Upload manages the lifecycle of an AWS S3 multipart upload.

This type realizes MultipartWrite through the following:

  • poll_ready ensures that there is a valid, active multipart upload, and that the number of pending part upload requests does not exceed configured capacity.
  • start_send accepts a PartBody, creates a part upload request future from it, and pushes it to a collection of these, where the responses are resolved asynchronously and independently. Current statistics of the upload are returned in the value UploadStatus.
  • poll_flush awaits all pending part upload request futures, draining the collection.
  • poll_complete flushes and then submits the request to complete the multipart upload, returning the response as the value Uploaded.

On completion, a new upload is started if possible. This relies on the ability of the ObjectUriIter that it was created with to generate the next upload URI. Polling for readiness ensures that the new upload has resolved to an upload ID before allowing start_send.

§Fusing

If ObjectUriIter::next ever produces None, the multipart upload will transition to a terminated state and it is not polled again.

Trait Implementations§

Source§

impl Debug for Upload

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FusedMultipartWrite<PartBody> for Upload

Source§

fn is_terminated(&self) -> bool

Returns true if the writer should no longer be polled.
Source§

impl MultipartWrite<PartBody> for Upload

Source§

type Error = Error

The type of value returned when an operation fails.
Source§

type Output = Uploaded

The type of value assembled from the parts when they have all been written.
Source§

type Recv = UploadStatus

The type of value returned when sending a part to be written began successfully.
Source§

fn poll_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>

Attempts to prepare the MultipartWrite to receive a new part. Read more
Source§

fn start_send( self: Pin<&mut Self>, part: PartBody, ) -> Result<Self::Recv, Self::Error>

Begin the process of writing a part to this writer, returning the associated type confirming it was received successfully. Read more
Source§

fn poll_flush( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>

Flush any remaining output from the writer. Read more
Source§

fn poll_complete( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<Self::Output, Self::Error>>

Complete the write, returning the output assembled from the written parts. Read more
Source§

impl<'pin> Unpin for Upload
where PinnedFieldsOf<__Upload<'pin>>: Unpin,

Auto Trait Implementations§

§

impl !Freeze for Upload

§

impl !RefUnwindSafe for Upload

§

impl Send for Upload

§

impl !Sync for Upload

§

impl UnsafeUnpin for Upload

§

impl !UnwindSafe for Upload

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<Wr, Part> MultipartWriteExt<Part> for Wr
where Wr: MultipartWrite<Part>,

Source§

fn boxed<'a>( self, ) -> Pin<Box<dyn MultipartWrite<Part, Error = Self::Error, Recv = Self::Recv, Output = Self::Output> + Send + 'a>>
where Self: Sized + Send + 'a,

Wrap this writer in a Box, pinning it.
Source§

fn box_fused<'a>( self, ) -> Pin<Box<dyn FusedMultipartWrite<Part, Error = Self::Error, Recv = Self::Recv, Output = Self::Output> + Send + 'a>>
where Self: Sized + Send + FusedMultipartWrite<Part> + 'a,

Wrap this writer, which additionally has conditions making it a FusedMultipartWrite, in a Box, pinning it.
Source§

fn box_fused_local<'a>( self, ) -> Pin<Box<dyn FusedMultipartWrite<Part, Error = Self::Error, Recv = Self::Recv, Output = Self::Output> + 'a>>
where Self: Sized + FusedMultipartWrite<Part> + 'a,

Wrap this writer, which additionally has conditions making it a FusedMultipartWrite, in a Box, pinning it. Read more
Source§

fn boxed_local<'a>( self, ) -> Pin<Box<dyn MultipartWrite<Part, Error = Self::Error, Recv = Self::Recv, Output = Self::Output> + 'a>>
where Self: Sized + 'a,

Wrap this writer in a Box, pinning it. Read more
Source§

fn buffered(self, capacity: impl Into<Option<usize>>) -> Buffered<Self, Part>
where Self: Sized,

Adds a fixed size buffer to the current writer. Read more
Source§

fn complete(&mut self) -> Complete<'_, Self, Part>
where Self: Unpin,

A future that runs this writer to completion, returning the associated output.
Source§

fn fanout<U>(self, other: U) -> Fanout<Self, U, Part>
where Part: Clone, U: MultipartWrite<Part, Error = Self::Error>, Self: Sized,

Fanout the part to multiple writers. Read more
Source§

fn feed(&mut self, part: Part) -> Feed<'_, Self, Part>
where Self: Unpin,

A future that completes after the given part has been received by the writer. Read more
Source§

fn filter_part<F>(self, f: F) -> FilterPart<Self, Part, F>
where F: FnMut(&Part) -> bool, Self: Sized,

Apply a filter to this writer’s parts, returning a new writer with the same output. Read more
Source§

fn filter_map_part<P, F>(self, f: F) -> FilterMapPart<Self, Part, P, F>
where F: FnMut(P) -> Option<Part>, Self: Sized,

Attempt to map the input to a part for this writer, filtering out the inputs where the mapping returns None. Read more
Source§

fn flush(&mut self) -> Flush<'_, Self, Part>
where Self: Unpin,

A future that completes when the underlying writer has been flushed.
Source§

fn fold_sent<T, F>(self, id: T, f: F) -> FoldSent<Self, T, F, Part>
where F: FnMut(T, &Self::Recv) -> T, Self: Sized,

Accumulate the values returned by starting a send, returning it with the output. Read more
Source§

fn for_each_recv<Fut, F>(self, f: F) -> ForEachRecv<Self, Part, Fut, F>
where Self: Sized, Self::Recv: Clone, F: FnMut(Self::Recv) -> Fut, Fut: Future<Output = ()>,

Evaluate the given async closure on the associated Self::Recv for this writer. Read more
Source§

fn fuse<F>(self, f: F) -> Fuse<Self, Part, F>
where F: FnMut(&Self::Output) -> bool, Self: Sized,

Returns a new writer that fuses according to the provided closure. Read more
Source§

fn lift<U, P>(self, other: U) -> Lift<Self, U, P, Part>
where Self: Sized, Self::Error: From<<U as MultipartWrite<P>>::Error>, U: MultipartWrite<P, Output = Part>,

Produce the parts for this writer from the output of another writer. Read more
Source§

fn map_sent<R, F>(self, f: F) -> MapSent<Self, Part, R, F>
where F: FnMut(Self::Recv) -> R, Self: Sized,

Map this writer’s return type to a different value, returning a new multipart writer with the given return type. Read more
Source§

fn map_err<E, F>(self, f: F) -> MapErr<Self, Part, E, F>
where F: FnMut(Self::Error) -> E, Self: Sized,

Map this writer’s error type to a different value, returning a new multipart writer with the given error type.
Source§

fn map_ok<T, F>(self, f: F) -> MapOk<Self, Part, T, F>
where F: FnMut(Self::Output) -> T, Self: Sized,

Map this writer’s output type to a different type, returning a new multipart writer with the given output type.
Source§

fn poll_ready_unpin( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
where Self: Unpin,

A convenience method for calling MultipartWrite::poll_ready on Unpin writer types.
Source§

fn poll_flush_unpin( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
where Self: Unpin,

A convenience method for calling MultipartWrite::poll_flush on Unpin writer types.
Source§

fn poll_complete_unpin( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<Self::Output, Self::Error>>
where Self: Unpin,

A convenience method for calling MultipartWrite::poll_complete on Unpin writer types.
Source§

fn ready_part<P, Fut, F>(self, f: F) -> ReadyPart<Self, Part, P, Fut, F>
where F: FnMut(P) -> Fut, Fut: Future<Output = Result<Part, Self::Error>>, Self: Sized,

Provide a part to this writer in the output of a future. Read more
Source§

fn send_flush(&mut self, part: Part) -> SendFlush<'_, Self, Part>
where Self: Unpin,

A future that completes when a part has been fully processed into the writer, including flushing.
Source§

fn then<T, Fut, F>(self, f: F) -> Then<Self, Part, T, Fut, F>
where F: FnMut(Result<Self::Output, Self::Error>) -> Fut, Fut: Future<Output = Result<T, Self::Error>>, Self: Sized,

Asynchronously map the result of completing this writer to a different result. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more