pub struct Storage { /* private fields */ }
Implementations§
Source§impl Storage
impl Storage
Sourcepub async fn download_uri(
&self,
key: String,
expires_in: Option<Duration>,
) -> Result<String, String>
pub async fn download_uri( &self, key: String, expires_in: Option<Duration>, ) -> Result<String, String>
if expires_in
is None
, then we assume the bucket is publicly accessible and return the
public URL. For this to work, you have to make sure the bucket’s policy allows public access.
TODO: validate the uri we return in this case is valid, and if not, return an error
§Arguments
key
- the key of the object to downloadexpires_in
- the duration for which the download URI will be valid
§Errors
- could not retrieve the download URI
Sourcepub async fn upload(
&self,
key: String,
bytes: Vec<u8>,
content_type: String,
_content_md5: String,
) -> Result<(), String>
pub async fn upload( &self, key: String, bytes: Vec<u8>, content_type: String, _content_md5: String, ) -> Result<(), String>
Sourcepub async fn upload_uri(
&self,
key: String,
expires_in: Duration,
) -> Result<UploadURI, String>
pub async fn upload_uri( &self, key: String, expires_in: Duration, ) -> Result<UploadURI, String>
pub fn new() -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Storage
impl !RefUnwindSafe for Storage
impl Send for Storage
impl Sync for Storage
impl Unpin for Storage
impl !UnwindSafe for Storage
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
Convert
self
to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
Convert
&self
to an expression for Diesel’s query builder. Read more