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>) -> Disk
pub fn new(driver: Arc<dyn StorageDriver>) -> Disk
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
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 more