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;
}Implementations§
Source§impl<P: BucketPerms> BucketRef<P>
impl<P: BucketPerms> BucketRef<P>
Sourcepub async fn list(&self, options: ListOptions) -> Result<ListIterator, Error>where
P::List: Granted<Lister>,
pub async fn list(&self, options: ListOptions) -> Result<ListIterator, Error>where
P::List: Granted<Lister>,
See Bucket::list.
Sourcepub async fn exists(&self, key: &str) -> Result<bool, Error>where
P::Attrs: Granted<Attrser>,
pub async fn exists(&self, key: &str) -> Result<bool, Error>where
P::Attrs: Granted<Attrser>,
See Bucket::exists.
Sourcepub async fn exists_with(
&self,
key: &str,
options: ExistsOptions,
) -> Result<bool, Error>where
P::Attrs: Granted<Attrser>,
pub async fn exists_with(
&self,
key: &str,
options: ExistsOptions,
) -> Result<bool, Error>where
P::Attrs: Granted<Attrser>,
See Bucket::exists_with.
Sourcepub async fn attrs(&self, key: &str) -> Result<ObjectAttrs, Error>where
P::Attrs: Granted<Attrser>,
pub async fn attrs(&self, key: &str) -> Result<ObjectAttrs, Error>where
P::Attrs: Granted<Attrser>,
See Bucket::attrs.
Sourcepub async fn attrs_with(
&self,
key: &str,
options: AttrsOptions,
) -> Result<ObjectAttrs, Error>where
P::Attrs: Granted<Attrser>,
pub async fn attrs_with(
&self,
key: &str,
options: AttrsOptions,
) -> Result<ObjectAttrs, Error>where
P::Attrs: Granted<Attrser>,
See Bucket::attrs_with.
Sourcepub async fn upload(
&self,
key: &str,
data: Vec<u8>,
) -> Result<ObjectAttrs, Error>where
P::Upload: Granted<Uploader>,
pub async fn upload(
&self,
key: &str,
data: Vec<u8>,
) -> Result<ObjectAttrs, Error>where
P::Upload: Granted<Uploader>,
See Bucket::upload.
Sourcepub async fn upload_with(
&self,
key: &str,
data: Vec<u8>,
options: UploadOptions,
) -> Result<ObjectAttrs, Error>where
P::Upload: Granted<Uploader>,
pub async fn upload_with(
&self,
key: &str,
data: Vec<u8>,
options: UploadOptions,
) -> Result<ObjectAttrs, Error>where
P::Upload: Granted<Uploader>,
See Bucket::upload_with.
Sourcepub async fn upload_stream(
&self,
key: &str,
reader: impl AsyncRead + Unpin + Send + Sync + 'static,
options: UploadOptions,
) -> Result<ObjectAttrs, Error>where
P::Upload: Granted<Uploader>,
pub async fn upload_stream(
&self,
key: &str,
reader: impl AsyncRead + Unpin + Send + Sync + 'static,
options: UploadOptions,
) -> Result<ObjectAttrs, Error>where
P::Upload: Granted<Uploader>,
Sourcepub async fn upload_chunks<S, B, E>(
&self,
key: &str,
chunks: S,
options: UploadOptions,
) -> Result<ObjectAttrs, Error>
pub async fn upload_chunks<S, B, E>( &self, key: &str, chunks: S, options: UploadOptions, ) -> Result<ObjectAttrs, Error>
Sourcepub async fn download(&self, key: &str) -> Result<Vec<u8>, Error>where
P::Download: Granted<Downloader>,
pub async fn download(&self, key: &str) -> Result<Vec<u8>, Error>where
P::Download: Granted<Downloader>,
See Bucket::download.
Sourcepub async fn download_with(
&self,
key: &str,
options: DownloadOptions,
) -> Result<Vec<u8>, Error>where
P::Download: Granted<Downloader>,
pub async fn download_with(
&self,
key: &str,
options: DownloadOptions,
) -> Result<Vec<u8>, Error>where
P::Download: Granted<Downloader>,
Sourcepub async fn download_stream(
&self,
key: &str,
options: DownloadOptions,
) -> Result<Download, Error>where
P::Download: Granted<Downloader>,
pub async fn download_stream(
&self,
key: &str,
options: DownloadOptions,
) -> Result<Download, Error>where
P::Download: Granted<Downloader>,
Sourcepub async fn remove(&self, key: &str) -> Result<(), Error>where
P::Remove: Granted<Remover>,
pub async fn remove(&self, key: &str) -> Result<(), Error>where
P::Remove: Granted<Remover>,
See Bucket::remove.
Sourcepub async fn remove_with(
&self,
key: &str,
options: RemoveOptions,
) -> Result<(), Error>where
P::Remove: Granted<Remover>,
pub async fn remove_with(
&self,
key: &str,
options: RemoveOptions,
) -> Result<(), Error>where
P::Remove: Granted<Remover>,
See Bucket::remove_with.
Sourcepub async fn signed_upload_url(
&self,
key: &str,
) -> Result<SignedUploadUrl, Error>where
P::SignedUpload: Granted<SignedUploader>,
pub async fn signed_upload_url(
&self,
key: &str,
) -> Result<SignedUploadUrl, Error>where
P::SignedUpload: Granted<SignedUploader>,
Sourcepub async fn signed_upload_url_with(
&self,
key: &str,
options: SignedUrlOptions,
) -> Result<SignedUploadUrl, Error>where
P::SignedUpload: Granted<SignedUploader>,
pub async fn signed_upload_url_with(
&self,
key: &str,
options: SignedUrlOptions,
) -> Result<SignedUploadUrl, Error>where
P::SignedUpload: Granted<SignedUploader>,
Sourcepub async fn signed_download_url(
&self,
key: &str,
) -> Result<SignedDownloadUrl, Error>where
P::SignedDownload: Granted<SignedDownloader>,
pub async fn signed_download_url(
&self,
key: &str,
) -> Result<SignedDownloadUrl, Error>where
P::SignedDownload: Granted<SignedDownloader>,
Sourcepub async fn signed_download_url_with(
&self,
key: &str,
options: SignedUrlOptions,
) -> Result<SignedDownloadUrl, Error>where
P::SignedDownload: Granted<SignedDownloader>,
pub async fn signed_download_url_with(
&self,
key: &str,
options: SignedUrlOptions,
) -> Result<SignedDownloadUrl, Error>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> Attrser for BucketRef<P>where
P::Attrs: Granted<Attrser>,
impl<P: BucketPerms> Attrser for BucketRef<P>where
P::Attrs: Granted<Attrser>,
Source§fn exists_with(
&self,
key: &str,
options: ExistsOptions,
) -> impl Future<Output = Result<bool, Error>> + Send
fn exists_with( &self, key: &str, options: ExistsOptions, ) -> impl Future<Output = Result<bool, Error>> + Send
See
Bucket::exists_with.Source§fn attrs_with(
&self,
key: &str,
options: AttrsOptions,
) -> impl Future<Output = Result<ObjectAttrs, Error>> + Send
fn attrs_with( &self, key: &str, options: AttrsOptions, ) -> impl Future<Output = Result<ObjectAttrs, Error>> + Send
See
Bucket::attrs_with.Source§fn exists(&self, key: &str) -> impl Future<Output = Result<bool, Error>> + Send
fn exists(&self, key: &str) -> impl Future<Output = Result<bool, Error>> + Send
See
Bucket::exists.Source§fn attrs(
&self,
key: &str,
) -> impl Future<Output = Result<ObjectAttrs, Error>> + Send
fn attrs( &self, key: &str, ) -> impl Future<Output = Result<ObjectAttrs, Error>> + Send
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§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 list(
&self,
options: ListOptions,
) -> impl Future<Output = Result<ListIterator, Error>> + Send
fn list( &self, options: ListOptions, ) -> impl Future<Output = Result<ListIterator, Error>> + Send
See
Bucket::list.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> SignedDownloader for BucketRef<P>where
P::SignedDownload: Granted<SignedDownloader>,
impl<P: BucketPerms> SignedDownloader for BucketRef<P>where
P::SignedDownload: Granted<SignedDownloader>,
Source§fn signed_download_url_with(
&self,
key: &str,
options: SignedUrlOptions,
) -> impl Future<Output = Result<SignedDownloadUrl, Error>> + Send
fn signed_download_url_with( &self, key: &str, options: SignedUrlOptions, ) -> impl Future<Output = Result<SignedDownloadUrl, Error>> + Send
Source§fn signed_download_url(
&self,
key: &str,
) -> impl Future<Output = Result<SignedDownloadUrl, Error>> + Send
fn signed_download_url( &self, key: &str, ) -> impl Future<Output = Result<SignedDownloadUrl, Error>> + Send
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 signed_upload_url_with(
&self,
key: &str,
options: SignedUrlOptions,
) -> impl Future<Output = Result<SignedUploadUrl, Error>> + Send
fn signed_upload_url_with( &self, key: &str, options: SignedUrlOptions, ) -> impl Future<Output = Result<SignedUploadUrl, Error>> + Send
Source§fn signed_upload_url(
&self,
key: &str,
) -> impl Future<Output = Result<SignedUploadUrl, Error>> + Send
fn signed_upload_url( &self, key: &str, ) -> impl Future<Output = Result<SignedUploadUrl, Error>> + Send
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 upload_with(
&self,
key: &str,
data: Vec<u8>,
options: UploadOptions,
) -> impl Future<Output = Result<ObjectAttrs, Error>> + Send
fn upload_with( &self, key: &str, data: Vec<u8>, options: UploadOptions, ) -> impl Future<Output = Result<ObjectAttrs, Error>> + Send
See
Bucket::upload_with.Source§fn upload_stream(
&self,
key: &str,
reader: impl AsyncRead + Unpin + Send + Sync + 'static,
options: UploadOptions,
) -> impl Future<Output = Result<ObjectAttrs, Error>> + Send
fn upload_stream( &self, key: &str, reader: impl AsyncRead + Unpin + Send + Sync + 'static, options: UploadOptions, ) -> impl Future<Output = Result<ObjectAttrs, Error>> + Send
Source§fn upload(
&self,
key: &str,
data: Vec<u8>,
) -> impl Future<Output = Result<ObjectAttrs, Error>> + Send
fn upload( &self, key: &str, data: Vec<u8>, ) -> impl Future<Output = Result<ObjectAttrs, Error>> + Send
See
Bucket::upload.Source§fn upload_chunks<S, B, E>(
&self,
key: &str,
chunks: S,
options: UploadOptions,
) -> impl Future<Output = Result<ObjectAttrs, Error>> + Send
fn upload_chunks<S, B, E>( &self, key: &str, chunks: S, options: UploadOptions, ) -> impl Future<Output = Result<ObjectAttrs, Error>> + Send
Auto Trait Implementations§
impl<P> Freeze 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::Request