pub struct File { /* private fields */ }Expand description
Represents a file within a Google Cloud Storage bucket.
Implementations§
Source§impl File
impl File
Sourcepub fn get_signed_url(
&self,
options: GetSignedUrlOptions,
) -> Result<String, StorageError>
pub fn get_signed_url( &self, options: GetSignedUrlOptions, ) -> Result<String, StorageError>
Generates a V4 signed URL for accessing the file.
§Arguments
options- The options for generating the signed URL.
Sourcepub async fn save(
&self,
body: impl Into<Body>,
mime_type: &str,
) -> Result<(), StorageError>
pub async fn save( &self, body: impl Into<Body>, mime_type: &str, ) -> Result<(), StorageError>
Uploads data to the file.
This method uses the simple upload API.
§Arguments
body- The data to upload.mime_type- The MIME type of the data.
Sourcepub async fn download(&self) -> Result<Bytes, StorageError>
pub async fn download(&self) -> Result<Bytes, StorageError>
Downloads the file’s content.
Sourcepub async fn delete(&self) -> Result<(), StorageError>
pub async fn delete(&self) -> Result<(), StorageError>
Deletes the file.
Sourcepub async fn get_metadata(&self) -> Result<ObjectMetadata, StorageError>
pub async fn get_metadata(&self) -> Result<ObjectMetadata, StorageError>
Gets the file’s metadata.
Sourcepub async fn set_metadata(
&self,
metadata: &ObjectMetadata,
) -> Result<ObjectMetadata, StorageError>
pub async fn set_metadata( &self, metadata: &ObjectMetadata, ) -> Result<ObjectMetadata, StorageError>
Sets the file’s metadata.
This method uses the PATCH method to update the file’s metadata.
Only non-null fields in the provided metadata object will be updated.
§Arguments
metadata- The metadata to set.
Auto Trait Implementations§
impl Freeze for File
impl !RefUnwindSafe for File
impl Send for File
impl Sync for File
impl Unpin for File
impl !UnwindSafe for File
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