Skip to main content

BucketRef

Struct BucketRef 

Source
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>

Source

pub fn list(&self) -> ListRequest<'static>
where P::List: Granted<Lister>,

Source

pub fn list_versions(&self) -> ListVersionsRequest<'static>
where P::List: Granted<Lister>,

Source

pub fn exists(&self, key: &str) -> ExistsRequest<'static>
where P::Attrs: Granted<Attrser>,

Source

pub fn attrs(&self, key: &str) -> AttrsRequest<'static>
where P::Attrs: Granted<Attrser>,

Source

pub fn upload( &self, key: &str, data: impl Into<UploadBody>, ) -> UploadRequest<'static>
where P::Upload: Granted<Uploader>,

Source

pub fn upload_if_match( &self, key: &str, data: impl Into<UploadBody>, revision: Revision, ) -> UploadIfMatchRequest<'static>
where P::IfMatchUpload: Granted<IfMatchUploader>,

Source

pub fn update_attrs(&self, key: &str) -> UpdateAttrsRequest<'static>
where P::UpdateAttrs: Granted<AttrsUpdater>,

Source

pub fn extend_retention( &self, key: &str, until: SystemTime, ) -> ExtendRetentionRequest<'static>
where P::UpdateAttrs: Granted<AttrsUpdater>,

Source

pub fn download(&self, key: &str) -> DownloadRequest<'static>
where P::Download: Granted<Downloader>,

Source

pub fn remove(&self, key: &str) -> RemoveRequest<'static>
where P::Remove: Granted<Remover>,

Source

pub async fn remove_if_match( &self, key: &str, revision: Revision, ) -> Result<(), Error>
where P::IfMatchRemove: Granted<IfMatchRemover>,

Source

pub fn signed_upload_url(&self, key: &str) -> SignedUploadUrlRequest<'static>
where P::SignedUpload: Granted<SignedUploader>,

Source

pub fn signed_download_url( &self, key: &str, ) -> SignedDownloadUrlRequest<'static>
where P::SignedDownload: Granted<SignedDownloader>,

Source

pub fn public_url(&self, key: &str) -> Result<String, Error>
where P::PublicUrl: Granted<PublicUrler>,

Trait Implementations§

Source§

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

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

Runs the extension extend_retention made, when it is awaited.
Source§

fn update_attrs(&self, key: &str) -> UpdateAttrsRequest<'_, Self>

Source§

fn extend_retention( &self, key: &str, until: SystemTime, ) -> ExtendRetentionRequest<'_, Self>

Source§

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

Runs the request exists made, when it is awaited.
Source§

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>

Source§

fn attrs(&self, key: &str) -> AttrsRequest<'_, Self>

Source§

impl<P> Clone for BucketRef<P>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<P> Copy for BucketRef<P>

Source§

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

Runs the download download made, when it is awaited. A fake answers with Download::of.
Source§

fn download(&self, key: &str) -> DownloadRequest<'_, Self>

Source§

impl<P: BucketPerms> IfMatchRemover for BucketRef<P>
where P::IfMatchRemove: Granted<IfMatchRemover>,

Source§

fn remove_if_match( &self, key: &str, revision: Revision, ) -> impl Future<Output = Result<(), Error>> + Send

Source§

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

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>

Source§

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

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

Runs the listing list_versions made, when it is awaited.
Source§

fn list(&self) -> ListRequest<'_, Self>

Source§

fn list_versions(&self) -> ListVersionsRequest<'_, Self>

Source§

impl<P: BucketPerms> PublicUrler for BucketRef<P>
where P::PublicUrl: Granted<PublicUrler>,

Source§

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

Runs the removal remove made, when it is awaited.
Source§

fn remove(&self, key: &str) -> RemoveRequest<'_, Self>

Source§

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

Runs the request signed_download_url made, when it is awaited.
Source§

fn signed_download_url(&self, key: &str) -> SignedDownloadUrlRequest<'_, Self>

Source§

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

Runs the request signed_upload_url made, when it is awaited.
Source§

fn signed_upload_url(&self, key: &str) -> SignedUploadUrlRequest<'_, Self>

Source§

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

Runs the upload upload made, when it is awaited.
Source§

fn upload( &self, key: &str, data: impl Into<UploadBody>, ) -> UploadRequest<'_, Self>

Auto Trait Implementations§

§

impl<P> Forget for BucketRef<P>

§

impl<P> Freeze for BucketRef<P>
where PhantomData<fn() -> P>: Freeze,

§

impl<P> Move for BucketRef<P>

§

impl<P> RefUnwindSafe for BucketRef<P>
where PhantomData<fn() -> P>: RefUnwindSafe,

§

impl<P> Send for BucketRef<P>
where PhantomData<fn() -> P>: Send,

§

impl<P> Sync for BucketRef<P>
where PhantomData<fn() -> P>: Sync,

§

impl<P> Unpin for BucketRef<P>
where PhantomData<fn() -> P>: Unpin,

§

impl<P> UnsafeUnpin for BucketRef<P>
where PhantomData<fn() -> P>: UnsafeUnpin,

§

impl<P> UnwindSafe for BucketRef<P>
where PhantomData<fn() -> P>: UnwindSafe,

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> AsOut<T> for T
where T: Copy,

Source§

fn as_out(&mut self) -> Out<'_, T>

Returns an out reference to self.
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

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

Source§

fn exact_from(value: T) -> U

Source§

impl<T, U> ExactInto<U> for T
where U: ExactFrom<T>,

Source§

fn exact_into(self) -> U

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self> ⓘ

Attaches the current Context to this type, returning a WithContext wrapper. Read more
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<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
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<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T, U> OverflowingInto<U> for T
where U: OverflowingFrom<T>,

Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ReadWriter for T

Source§

impl<T, U> RoundingInto<U> for T
where U: RoundingFrom<T>,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> SaturatingInto<U> for T
where U: SaturatingFrom<T>,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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
Source§

impl<T, U> WrappingInto<U> for T
where U: WrappingFrom<T>,

Source§

fn wrapping_into(self) -> U