pub struct StorageService { /* private fields */ }Expand description
Represents an implementation of a StorageService for the
local filesystem.
Implementations§
Source§impl StorageService
impl StorageService
Sourcepub fn new<P: AsRef<Path>>(path: P) -> StorageService
pub fn new<P: AsRef<Path>>(path: P) -> StorageService
Creates a new StorageService instance.
Sourcepub fn with_config(config: StorageConfig) -> StorageService
pub fn with_config(config: StorageConfig) -> StorageService
Creates a new StorageService instance with a provided configuration object.
Sourcepub fn with_resolver<R: ContentTypeResolver + 'static>(
self,
resolver: R,
) -> StorageService
pub fn with_resolver<R: ContentTypeResolver + 'static>( self, resolver: R, ) -> StorageService
Updates the given ContentTypeResolver to something else.
Sourcepub fn normalize<P: AsRef<Path>>(&self, path: P) -> Result<Option<PathBuf>>
pub fn normalize<P: AsRef<Path>>(&self, path: P) -> Result<Option<PathBuf>>
Attempts to normalize a given path and returns a canonical, absolute path. It must follow some strict rules:
-
If the path starts with
./, then it will resolve fromStorageConfig::directoryif the directory was found. Otherwise, it’ll use the current directory. -
If the path starts with
~/, then it will resolve from the home directory frometcetera::home_dir.
Trait Implementations§
Source§impl Clone for StorageService
impl Clone for StorageService
Source§fn clone(&self) -> StorageService
fn clone(&self) -> StorageService
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl StorageService for StorageService
impl StorageService for StorageService
Source§type Error = Error
type Error = Error
Represents a generic error to use for errors that could be emitted
when calling any function.
Source§fn init<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn init<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Optionally initialize this
StorageService if it requires initialization,
like creating a directory if it doesn’t exist. Read moreSource§fn open<'life0, 'async_trait, P>(
&'life0 self,
path: P,
) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>>> + Send + 'async_trait>>
fn open<'life0, 'async_trait, P>( &'life0 self, path: P, ) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>>> + Send + 'async_trait>>
Source§fn blob<'life0, 'async_trait, P>(
&'life0 self,
path: P,
) -> Pin<Box<dyn Future<Output = Result<Option<Blob>>> + Send + 'async_trait>>
fn blob<'life0, 'async_trait, P>( &'life0 self, path: P, ) -> Pin<Box<dyn Future<Output = Result<Option<Blob>>> + Send + 'async_trait>>
Source§fn blobs<'life0, 'async_trait, P>(
&'life0 self,
path: Option<P>,
options: Option<ListBlobsRequest>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Blob>>> + Send + 'async_trait>>
fn blobs<'life0, 'async_trait, P>( &'life0 self, path: Option<P>, options: Option<ListBlobsRequest>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Blob>>> + Send + 'async_trait>>
Source§fn delete<'life0, 'async_trait, P>(
&'life0 self,
path: P,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
fn delete<'life0, 'async_trait, P>( &'life0 self, path: P, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
Deletes a file in a specified
path. At the moment, () is returned but bool might be
returned to indicate if it actually deleted itself or not. Read moreSource§fn exists<'life0, 'async_trait, P>(
&'life0 self,
path: P,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
fn exists<'life0, 'async_trait, P>( &'life0 self, path: P, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
Checks the existence of the file by the specified path. Read more
Auto Trait Implementations§
impl Freeze for StorageService
impl !RefUnwindSafe for StorageService
impl Send for StorageService
impl Sync for StorageService
impl Unpin for StorageService
impl !UnwindSafe for StorageService
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