pub struct UploadRequest<'a, T: ?Sized = Bucket> {
pub key: String,
pub data: UploadBody,
pub content_type: Option<String>,
pub cache_control: Option<String>,
pub content_disposition: Option<String>,
pub metadata: BTreeMap<String, String>,
pub storage_class: Option<StorageClass>,
pub retain_until: Option<SystemTime>,
pub not_exists: bool,
/* private fields */
}Expand description
Request builder returned by Bucket::upload.
Configure upload options with builder methods and .await to execute and
receive the stored ObjectAttrs. Fields are public for inspecting
requests in fake Uploader implementations.
Fields§
§key: String§data: UploadBody§content_type: Option<String>§cache_control: Option<String>§content_disposition: Option<String>§metadata: BTreeMap<String, String>§storage_class: Option<StorageClass>§retain_until: Option<SystemTime>§not_exists: boolImplementations§
Source§impl<'a, T: ?Sized> UploadRequest<'a, T>
impl<'a, T: ?Sized> UploadRequest<'a, T>
Sourcepub fn content_type(self, content_type: impl Into<String>) -> Self
pub fn content_type(self, content_type: impl Into<String>) -> Self
Sets the object’s Content-Type header (for example,
application/pdf).
Sourcepub fn cache_control(self, cache_control: impl Into<String>) -> Self
pub fn cache_control(self, cache_control: impl Into<String>) -> Self
Sets the Cache-Control header the object is served with (for
example, public, max-age=3600).
Sourcepub fn content_disposition(self, content_disposition: impl Into<String>) -> Self
pub fn content_disposition(self, content_disposition: impl Into<String>) -> Self
Sets the Content-Disposition header the object is served with (for
example, attachment; filename="a.pdf").
Sourcepub fn metadata<K, V>(self, metadata: impl IntoIterator<Item = (K, V)>) -> Self
pub fn metadata<K, V>(self, metadata: impl IntoIterator<Item = (K, V)>) -> Self
Adds custom metadata key/value pairs (such as [("owner", "42")]),
replacing any existing entries with the same keys.
Keys must contain only lowercase letters, digits, -, and _, and
cannot start with - or _. Values must be printable ASCII.
Sourcepub fn storage_class(self, class: StorageClass) -> Self
pub fn storage_class(self, class: StorageClass) -> Self
Overrides the bucket’s default storage class for this object.
StorageClass::Auto is only valid at the bucket level and is
rejected here.
Sourcepub fn retain_until(self, until: SystemTime) -> Self
pub fn retain_until(self, until: SystemTime) -> Self
Retains the object until at least until in a bucket declared with
Bucket::object_retention.
Sourcepub fn not_exists(self) -> Self
pub fn not_exists(self) -> Self
Fails with Error::PreconditionFailed if an object with this key
already exists.
Trait Implementations§
Source§impl<'a> IntoFuture for UploadRequest<'a, Bucket>
impl<'a> IntoFuture for UploadRequest<'a, Bucket>
Source§type Output = Result<ObjectAttrs, Error>
type Output = Result<ObjectAttrs, Error>
Source§type IntoFuture = Pin<Box<dyn Future<Output = <UploadRequest<'a> as IntoFuture>::Output> + Send + 'a>>
type IntoFuture = Pin<Box<dyn Future<Output = <UploadRequest<'a> as IntoFuture>::Output> + Send + 'a>>
Source§fn into_future(self) -> Self::IntoFuture
fn into_future(self) -> Self::IntoFuture
Source§impl<'a, T: Uploader + ?Sized> IntoFuture for UploadRequest<'a, T>
impl<'a, T: Uploader + ?Sized> IntoFuture for UploadRequest<'a, T>
Source§type Output = Result<ObjectAttrs, Error>
type Output = Result<ObjectAttrs, Error>
Source§type IntoFuture = Pin<Box<dyn Future<Output = <UploadRequest<'a, T> as IntoFuture>::Output> + Send + 'a>>
type IntoFuture = Pin<Box<dyn Future<Output = <UploadRequest<'a, T> as IntoFuture>::Output> + Send + 'a>>
Source§fn into_future(self) -> Self::IntoFuture
fn into_future(self) -> Self::IntoFuture
Auto Trait Implementations§
impl<'a, T = Bucket> !Freeze for UploadRequest<'a, T>
impl<'a, T = Bucket> !RefUnwindSafe for UploadRequest<'a, T>
impl<'a, T = Bucket> !UnwindSafe for UploadRequest<'a, T>
impl<'a, T> Forget for UploadRequest<'a, T>where
T: ?Sized,
impl<'a, T> Move for UploadRequest<'a, T>where
T: ?Sized,
impl<'a, T> Send for UploadRequest<'a, T>
impl<'a, T> Sync for UploadRequest<'a, T>
impl<'a, T> Unpin for UploadRequest<'a, T>
impl<'a, T> UnsafeUnpin for UploadRequest<'a, T>where
&'a T: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const u8: UnsafeUnpin,
Align8<*mut ()>: UnsafeUnpin,
&'static Vtable: UnsafeUnpin,
*const dyn AsyncRead + Unpin + Sync + Send is !null: UnsafeUnpin,
PhantomData<dyn AsyncRead + Unpin + Sync + Send>: UnsafeUnpin,
*const LeafNode<String, String> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, String)>>: UnsafeUnpin,
T: ?Sized,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request