pub struct BucketRef<P> { /* private fields */ }Expand description
A reference to a Bucket that grants only the permissions P, made by
Bucket::reference. Copy, and free to pass to other code.
Its methods are the bucket’s, for the permissions it grants: a
BucketRef<perms::Uploader> can upload but not download. Each is also
a method of its permission’s trait, which library code takes instead of a
BucketRef.
ⓘ
async fn upload() {
// A `Lister` reference cannot upload.
let _ = UPLOADS.reference::<perms::Lister>().upload("a", vec![]).await;
}ⓘ
async fn update() {
// Uploading is not changing attributes: that is `AttrsUpdater`.
let r = UPLOADS.reference::<perms::Uploader>();
let _ = r.update_attrs("a").cache_control("no-store").await;
}ⓘ
async fn replace(seen: Revision) {
// Uploading over a revision is `IfMatchUploader`.
let r = UPLOADS.reference::<perms::Uploader>();
let _ = r.upload_if_match("a", vec![], seen).await;
}Implementations§
Source§impl<P: BucketPerms> BucketRef<P>
impl<P: BucketPerms> BucketRef<P>
Sourcepub fn list(&self) -> ListRequest<'static>where
P::List: Granted<Lister>,
pub fn list(&self) -> ListRequest<'static>where
P::List: Granted<Lister>,
See Bucket::list.
Sourcepub fn list_versions(&self) -> ListVersionsRequest<'static>where
P::List: Granted<Lister>,
pub fn list_versions(&self) -> ListVersionsRequest<'static>where
P::List: Granted<Lister>,
Sourcepub fn exists(&self, key: &str) -> ExistsRequest<'static>where
P::Attrs: Granted<Attrser>,
pub fn exists(&self, key: &str) -> ExistsRequest<'static>where
P::Attrs: Granted<Attrser>,
See Bucket::exists.
Sourcepub fn attrs(&self, key: &str) -> AttrsRequest<'static>where
P::Attrs: Granted<Attrser>,
pub fn attrs(&self, key: &str) -> AttrsRequest<'static>where
P::Attrs: Granted<Attrser>,
See Bucket::attrs.
Sourcepub fn upload(
&self,
key: &str,
data: impl Into<UploadBody>,
) -> UploadRequest<'static>where
P::Upload: Granted<Uploader>,
pub fn upload(
&self,
key: &str,
data: impl Into<UploadBody>,
) -> UploadRequest<'static>where
P::Upload: Granted<Uploader>,
See Bucket::upload.
Sourcepub fn upload_if_match(
&self,
key: &str,
data: impl Into<UploadBody>,
revision: Revision,
) -> UploadIfMatchRequest<'static>where
P::IfMatchUpload: Granted<IfMatchUploader>,
pub fn upload_if_match(
&self,
key: &str,
data: impl Into<UploadBody>,
revision: Revision,
) -> UploadIfMatchRequest<'static>where
P::IfMatchUpload: Granted<IfMatchUploader>,
Sourcepub fn update_attrs(&self, key: &str) -> UpdateAttrsRequest<'static>where
P::UpdateAttrs: Granted<AttrsUpdater>,
pub fn update_attrs(&self, key: &str) -> UpdateAttrsRequest<'static>where
P::UpdateAttrs: Granted<AttrsUpdater>,
See Bucket::update_attrs.
Sourcepub fn extend_retention(
&self,
key: &str,
until: SystemTime,
) -> ExtendRetentionRequest<'static>where
P::UpdateAttrs: Granted<AttrsUpdater>,
pub fn extend_retention(
&self,
key: &str,
until: SystemTime,
) -> ExtendRetentionRequest<'static>where
P::UpdateAttrs: Granted<AttrsUpdater>,
Sourcepub fn download(&self, key: &str) -> DownloadRequest<'static>where
P::Download: Granted<Downloader>,
pub fn download(&self, key: &str) -> DownloadRequest<'static>where
P::Download: Granted<Downloader>,
See Bucket::download.
Sourcepub fn remove(&self, key: &str) -> RemoveRequest<'static>where
P::Remove: Granted<Remover>,
pub fn remove(&self, key: &str) -> RemoveRequest<'static>where
P::Remove: Granted<Remover>,
See Bucket::remove.
Sourcepub async fn remove_if_match(
&self,
key: &str,
revision: Revision,
) -> Result<(), Error>where
P::IfMatchRemove: Granted<IfMatchRemover>,
pub async fn remove_if_match(
&self,
key: &str,
revision: Revision,
) -> Result<(), Error>where
P::IfMatchRemove: Granted<IfMatchRemover>,
Sourcepub fn signed_upload_url(&self, key: &str) -> SignedUploadUrlRequest<'static>where
P::SignedUpload: Granted<SignedUploader>,
pub fn signed_upload_url(&self, key: &str) -> SignedUploadUrlRequest<'static>where
P::SignedUpload: Granted<SignedUploader>,
Sourcepub fn signed_download_url(
&self,
key: &str,
) -> SignedDownloadUrlRequest<'static>where
P::SignedDownload: Granted<SignedDownloader>,
pub fn signed_download_url(
&self,
key: &str,
) -> SignedDownloadUrlRequest<'static>where
P::SignedDownload: Granted<SignedDownloader>,
Sourcepub fn public_url(&self, key: &str) -> Result<String, Error>where
P::PublicUrl: Granted<PublicUrler>,
pub fn public_url(&self, key: &str) -> Result<String, Error>where
P::PublicUrl: Granted<PublicUrler>,
See Bucket::public_url.
Trait Implementations§
Source§impl<P: BucketPerms> AttrsUpdater for BucketRef<P>where
P::UpdateAttrs: Granted<AttrsUpdater>,
impl<P: BucketPerms> AttrsUpdater for BucketRef<P>where
P::UpdateAttrs: Granted<AttrsUpdater>,
Source§fn run_update_attrs(
&self,
request: UpdateAttrsRequest<'_, Self>,
) -> impl Future<Output = Result<ObjectAttrs, Error>> + Send
fn run_update_attrs( &self, request: UpdateAttrsRequest<'_, Self>, ) -> impl Future<Output = Result<ObjectAttrs, Error>> + Send
Runs the change
update_attrs made, when it is
awaited.Source§fn run_extend_retention(
&self,
request: ExtendRetentionRequest<'_, Self>,
) -> impl Future<Output = Result<ObjectAttrs, Error>> + Send
fn run_extend_retention( &self, request: ExtendRetentionRequest<'_, Self>, ) -> impl Future<Output = Result<ObjectAttrs, Error>> + Send
Runs the extension
extend_retention made,
when it is awaited.Source§fn update_attrs(&self, key: &str) -> UpdateAttrsRequest<'_, Self>
fn update_attrs(&self, key: &str) -> UpdateAttrsRequest<'_, Self>
See
Bucket::update_attrs.Source§fn extend_retention(
&self,
key: &str,
until: SystemTime,
) -> ExtendRetentionRequest<'_, Self>
fn extend_retention( &self, key: &str, until: SystemTime, ) -> ExtendRetentionRequest<'_, Self>
Source§impl<P: BucketPerms> Attrser for BucketRef<P>where
P::Attrs: Granted<Attrser>,
impl<P: BucketPerms> Attrser for BucketRef<P>where
P::Attrs: Granted<Attrser>,
Source§fn run_exists(
&self,
request: ExistsRequest<'_, Self>,
) -> impl Future<Output = Result<bool, Error>> + Send
fn run_exists( &self, request: ExistsRequest<'_, Self>, ) -> impl Future<Output = Result<bool, Error>> + Send
Runs the request
exists made, when it is awaited.Source§fn run_attrs(
&self,
request: AttrsRequest<'_, Self>,
) -> impl Future<Output = Result<ObjectAttrs, Error>> + Send
fn run_attrs( &self, request: AttrsRequest<'_, Self>, ) -> impl Future<Output = Result<ObjectAttrs, Error>> + Send
Runs the request
attrs made, when it is awaited.Source§fn exists(&self, key: &str) -> ExistsRequest<'_, Self>
fn exists(&self, key: &str) -> ExistsRequest<'_, Self>
See
Bucket::exists.Source§fn attrs(&self, key: &str) -> AttrsRequest<'_, Self>
fn attrs(&self, key: &str) -> AttrsRequest<'_, Self>
See
Bucket::attrs.impl<P> Copy for BucketRef<P>
Source§impl<P: BucketPerms> Downloader for BucketRef<P>where
P::Download: Granted<Downloader>,
impl<P: BucketPerms> Downloader for BucketRef<P>where
P::Download: Granted<Downloader>,
Source§fn run_download(
&self,
request: DownloadRequest<'_, Self>,
) -> impl Future<Output = Result<Download, Error>> + Send
fn run_download( &self, request: DownloadRequest<'_, Self>, ) -> impl Future<Output = Result<Download, Error>> + Send
Runs the download
download made, when it is
awaited. A fake answers with Download::of.Source§fn download(&self, key: &str) -> DownloadRequest<'_, Self>
fn download(&self, key: &str) -> DownloadRequest<'_, Self>
See
Bucket::download.Source§impl<P: BucketPerms> IfMatchRemover for BucketRef<P>where
P::IfMatchRemove: Granted<IfMatchRemover>,
impl<P: BucketPerms> IfMatchRemover for BucketRef<P>where
P::IfMatchRemove: Granted<IfMatchRemover>,
Source§impl<P: BucketPerms> IfMatchUploader for BucketRef<P>where
P::IfMatchUpload: Granted<IfMatchUploader>,
impl<P: BucketPerms> IfMatchUploader for BucketRef<P>where
P::IfMatchUpload: Granted<IfMatchUploader>,
Source§fn run_upload_if_match(
&self,
request: UploadIfMatchRequest<'_, Self>,
) -> impl Future<Output = Result<ObjectAttrs, Error>> + Send
fn run_upload_if_match( &self, request: UploadIfMatchRequest<'_, Self>, ) -> impl Future<Output = Result<ObjectAttrs, Error>> + Send
Runs the upload
upload_if_match made, when
it is awaited.Source§fn upload_if_match(
&self,
key: &str,
data: impl Into<UploadBody>,
revision: Revision,
) -> UploadIfMatchRequest<'_, Self>
fn upload_if_match( &self, key: &str, data: impl Into<UploadBody>, revision: Revision, ) -> UploadIfMatchRequest<'_, Self>
Source§impl<P: BucketPerms> Lister for BucketRef<P>where
P::List: Granted<Lister>,
impl<P: BucketPerms> Lister for BucketRef<P>where
P::List: Granted<Lister>,
Source§fn run_list(
&self,
request: ListRequest<'_, Self>,
) -> impl Future<Output = Result<ListIterator, Error>> + Send
fn run_list( &self, request: ListRequest<'_, Self>, ) -> impl Future<Output = Result<ListIterator, Error>> + Send
Runs the listing
list made, when it is awaited.Source§fn run_list_versions(
&self,
request: ListVersionsRequest<'_, Self>,
) -> impl Future<Output = Result<VersionIterator, Error>> + Send
fn run_list_versions( &self, request: ListVersionsRequest<'_, Self>, ) -> impl Future<Output = Result<VersionIterator, Error>> + Send
Runs the listing
list_versions made, when it
is awaited.Source§fn list(&self) -> ListRequest<'_, Self>
fn list(&self) -> ListRequest<'_, Self>
See
Bucket::list.Source§fn list_versions(&self) -> ListVersionsRequest<'_, Self>
fn list_versions(&self) -> ListVersionsRequest<'_, Self>
Source§impl<P: BucketPerms> PublicUrler for BucketRef<P>where
P::PublicUrl: Granted<PublicUrler>,
impl<P: BucketPerms> PublicUrler for BucketRef<P>where
P::PublicUrl: Granted<PublicUrler>,
Source§fn public_url(&self, key: &str) -> Result<String, Error>
fn public_url(&self, key: &str) -> Result<String, Error>
See
Bucket::public_url.Source§impl<P: BucketPerms> Remover for BucketRef<P>where
P::Remove: Granted<Remover>,
impl<P: BucketPerms> Remover for BucketRef<P>where
P::Remove: Granted<Remover>,
Source§fn run_remove(
&self,
request: RemoveRequest<'_, Self>,
) -> impl Future<Output = Result<(), Error>> + Send
fn run_remove( &self, request: RemoveRequest<'_, Self>, ) -> impl Future<Output = Result<(), Error>> + Send
Runs the removal
remove made, when it is awaited.Source§fn remove(&self, key: &str) -> RemoveRequest<'_, Self>
fn remove(&self, key: &str) -> RemoveRequest<'_, Self>
See
Bucket::remove.Source§impl<P: BucketPerms> SignedDownloader for BucketRef<P>where
P::SignedDownload: Granted<SignedDownloader>,
impl<P: BucketPerms> SignedDownloader for BucketRef<P>where
P::SignedDownload: Granted<SignedDownloader>,
Source§fn run_signed_download_url(
&self,
request: SignedDownloadUrlRequest<'_, Self>,
) -> impl Future<Output = Result<SignedDownloadUrl, Error>> + Send
fn run_signed_download_url( &self, request: SignedDownloadUrlRequest<'_, Self>, ) -> impl Future<Output = Result<SignedDownloadUrl, Error>> + Send
Runs the request
signed_download_url
made, when it is awaited.Source§fn signed_download_url(&self, key: &str) -> SignedDownloadUrlRequest<'_, Self>
fn signed_download_url(&self, key: &str) -> SignedDownloadUrlRequest<'_, Self>
Source§impl<P: BucketPerms> SignedUploader for BucketRef<P>where
P::SignedUpload: Granted<SignedUploader>,
impl<P: BucketPerms> SignedUploader for BucketRef<P>where
P::SignedUpload: Granted<SignedUploader>,
Source§fn run_signed_upload_url(
&self,
request: SignedUploadUrlRequest<'_, Self>,
) -> impl Future<Output = Result<SignedUploadUrl, Error>> + Send
fn run_signed_upload_url( &self, request: SignedUploadUrlRequest<'_, Self>, ) -> impl Future<Output = Result<SignedUploadUrl, Error>> + Send
Runs the request
signed_upload_url made,
when it is awaited.Source§fn signed_upload_url(&self, key: &str) -> SignedUploadUrlRequest<'_, Self>
fn signed_upload_url(&self, key: &str) -> SignedUploadUrlRequest<'_, Self>
Source§impl<P: BucketPerms> Uploader for BucketRef<P>where
P::Upload: Granted<Uploader>,
impl<P: BucketPerms> Uploader for BucketRef<P>where
P::Upload: Granted<Uploader>,
Source§fn run_upload(
&self,
request: UploadRequest<'_, Self>,
) -> impl Future<Output = Result<ObjectAttrs, Error>> + Send
fn run_upload( &self, request: UploadRequest<'_, Self>, ) -> impl Future<Output = Result<ObjectAttrs, Error>> + Send
Runs the upload
upload made, when it is awaited.Source§fn upload(
&self,
key: &str,
data: impl Into<UploadBody>,
) -> UploadRequest<'_, Self>
fn upload( &self, key: &str, data: impl Into<UploadBody>, ) -> UploadRequest<'_, Self>
See
Bucket::upload.Auto Trait Implementations§
impl<P> Forget for BucketRef<P>
impl<P> Freeze for BucketRef<P>
impl<P> Move for BucketRef<P>
impl<P> RefUnwindSafe for BucketRef<P>
impl<P> Send for BucketRef<P>
impl<P> Sync for BucketRef<P>
impl<P> Unpin for BucketRef<P>
impl<P> UnsafeUnpin for BucketRef<P>
impl<P> UnwindSafe for BucketRef<P>
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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 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> ⓘ
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 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>
Wrap the input message
T in a tonic::RequestCreates a shared type from an unshared type.