pub struct Disk { /* private fields */ }Expand description
A handle to a specific disk.
Implementations§
Source§impl Disk
impl Disk
Sourcepub fn new(driver: Arc<dyn StorageDriver>) -> Self
pub fn new(driver: Arc<dyn StorageDriver>) -> Self
Create a disk from a driver.
Sourcepub async fn put(
&self,
path: &str,
contents: impl Into<Bytes>,
) -> Result<(), Error>
pub async fn put( &self, path: &str, contents: impl Into<Bytes>, ) -> Result<(), Error>
Put file contents.
Sourcepub async fn put_with_options(
&self,
path: &str,
contents: impl Into<Bytes>,
options: PutOptions,
) -> Result<(), Error>
pub async fn put_with_options( &self, path: &str, contents: impl Into<Bytes>, options: PutOptions, ) -> Result<(), Error>
Put with options.
Sourcepub async fn temporary_url(
&self,
path: &str,
expiration: Duration,
) -> Result<String, Error>
pub async fn temporary_url( &self, path: &str, expiration: Duration, ) -> Result<String, Error>
Get temporary URL.
Sourcepub async fn files(&self, directory: &str) -> Result<Vec<String>, Error>
pub async fn files(&self, directory: &str) -> Result<Vec<String>, Error>
List files in a directory.
Sourcepub async fn all_files(&self, directory: &str) -> Result<Vec<String>, Error>
pub async fn all_files(&self, directory: &str) -> Result<Vec<String>, Error>
List all files recursively.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Disk
impl !RefUnwindSafe for Disk
impl Send for Disk
impl Sync for Disk
impl Unpin for Disk
impl UnsafeUnpin for Disk
impl !UnwindSafe for Disk
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