Skip to main content

Storage

Trait Storage 

Source
pub trait Storage: Send + Sync {
    // Required methods
    fn put(
        &self,
        path: &str,
        contents: Vec<u8>,
    ) -> impl Future<Output = Result<()>> + Send;
    fn put_with(
        &self,
        path: &str,
        contents: Vec<u8>,
        visibility: Visibility,
    ) -> impl Future<Output = Result<()>> + Send;
    fn get(&self, path: &str) -> impl Future<Output = Result<Vec<u8>>> + Send;
    fn exists(&self, path: &str) -> impl Future<Output = Result<bool>> + Send;
    fn delete(&self, path: &str) -> impl Future<Output = Result<()>> + Send;
    fn size(&self, path: &str) -> impl Future<Output = Result<u64>> + Send;
    fn list(
        &self,
        prefix: &str,
    ) -> impl Future<Output = Result<Vec<Entry>>> + Send;
    fn url(&self, path: &str) -> Option<String>;
}
Expand description

The operations every driver supports.

Required Methods§

Source

fn put( &self, path: &str, contents: Vec<u8>, ) -> impl Future<Output = Result<()>> + Send

Source

fn put_with( &self, path: &str, contents: Vec<u8>, visibility: Visibility, ) -> impl Future<Output = Result<()>> + Send

Source

fn get(&self, path: &str) -> impl Future<Output = Result<Vec<u8>>> + Send

Source

fn exists(&self, path: &str) -> impl Future<Output = Result<bool>> + Send

Source

fn delete(&self, path: &str) -> impl Future<Output = Result<()>> + Send

Source

fn size(&self, path: &str) -> impl Future<Output = Result<u64>> + Send

Source

fn list(&self, prefix: &str) -> impl Future<Output = Result<Vec<Entry>>> + Send

Everything directly under a prefix.

Source

fn url(&self, path: &str) -> Option<String>

A URL a browser can fetch, when the driver can produce one.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§