aws_multipart_upload/client/request/
abort.rs1use super::AbortRequestBuilder;
2use crate::client::{UploadClient, UploadId};
3use crate::error::Result;
4use crate::uri::ObjectUri;
5
6use std::fmt::{self, Debug, Formatter};
7use std::pin::Pin;
8use std::task::{Context, Poll};
9
10pub struct SendAbortUpload(pub(crate) Pin<Box<dyn Future<Output = Result<()>>>>);
12
13impl SendAbortUpload {
14 pub fn new(client: &UploadClient, req: AbortRequest) -> Self {
16 let cli = client.clone();
17 Self(Box::pin(
18 async move { cli.inner.send_abort_upload(req).await },
19 ))
20 }
21}
22
23impl Future for SendAbortUpload {
24 type Output = Result<()>;
25 fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
26 self.0.as_mut().poll(cx)
27 }
28}
29
30impl Debug for SendAbortUpload {
31 fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
32 f.debug_tuple("SendAbortUpload")
33 .field(&"Future<Output = Result<()>>")
34 .finish()
35 }
36}
37
38#[derive(Debug, Clone)]
40pub struct AbortRequest {
41 pub(crate) id: UploadId,
42 pub(crate) uri: ObjectUri,
43}
44
45impl AbortRequest {
46 pub fn new(id: UploadId, uri: ObjectUri) -> Self {
48 Self { id, uri }
49 }
50
51 pub fn with_builder(&self, builder: AbortRequestBuilder) -> AbortRequestBuilder {
53 builder
54 .bucket(&*self.uri.bucket)
55 .key(&*self.uri.key)
56 .upload_id(&*self.id)
57 }
58}