Trait photondb::env::Env

source ·
pub trait Env: Clone + Send + Sync + 'static {
    type PositionalReader: PositionalReader;
    type SequentialWriter: SequentialWriter;
    type JoinHandle<T: Send>: Future<Output = T> + Send;
    type Directory: Directory + Send + Sync + 'static;

    fn open_positional_reader<'life0, 'async_trait, P>(
        &'life0 self,
        path: P
    ) -> Pin<Box<dyn Future<Output = Result<Self::PositionalReader>> + Send + 'async_trait>>
    where
        P: AsRef<Path> + Send,
        P: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
; fn open_sequential_writer<'life0, 'async_trait, P>(
        &'life0 self,
        path: P
    ) -> Pin<Box<dyn Future<Output = Result<Self::SequentialWriter>> + Send + 'async_trait>>
    where
        P: AsRef<Path> + Send,
        P: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
; fn spawn_background<F>(&self, f: F) -> Self::JoinHandle<F::Output>
    where
        F: Future + Send + 'static,
        F::Output: Send
; fn rename<'life0, 'async_trait, P, Q>(
        &'life0 self,
        from: P,
        to: Q
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
    where
        P: 'async_trait + AsRef<Path> + Send,
        Q: 'async_trait + AsRef<Path> + Send,
        'life0: 'async_trait,
        Self: 'async_trait
; fn remove_file<'life0, 'async_trait, P>(
        &'life0 self,
        path: P
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
    where
        P: 'async_trait + AsRef<Path> + Send,
        'life0: 'async_trait,
        Self: 'async_trait
; fn create_dir_all<'life0, 'async_trait, P>(
        &'life0 self,
        path: P
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
    where
        P: 'async_trait + AsRef<Path> + Send,
        'life0: 'async_trait,
        Self: 'async_trait
; fn remove_dir_all<'life0, 'async_trait, P>(
        &'life0 self,
        path: P
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
    where
        P: 'async_trait + AsRef<Path> + Send,
        'life0: 'async_trait,
        Self: 'async_trait
; fn read_dir<P: AsRef<Path>>(&self, path: P) -> Result<ReadDir>; fn metadata<'life0, 'async_trait, P>(
        &'life0 self,
        path: P
    ) -> Pin<Box<dyn Future<Output = Result<Metadata>> + Send + 'async_trait>>
    where
        P: 'async_trait + AsRef<Path> + Send,
        'life0: 'async_trait,
        Self: 'async_trait
; fn open_dir<'life0, 'async_trait, P>(
        &'life0 self,
        path: P
    ) -> Pin<Box<dyn Future<Output = Result<Self::Directory>> + Send + 'async_trait>>
    where
        P: 'async_trait + AsRef<Path> + Send,
        'life0: 'async_trait,
        Self: 'async_trait
; }
Expand description

Provides an environment to interact with a specific platform.

Required Associated Types§

Positional readers returned by the environment.

Sequential writers returned by the environment.

Handles to await tasks spawned by the environment.

Directories returned by the environment.

Required Methods§

Opens a file for positional reads.

Opens a file for sequential writes.

Spawns a task to run in the background.

An async version of std::fs::rename.

Removes a file from the filesystem. See also std::fs::remove_file.

Recursively create a directory and all of its parent components if they are missing. See also std::fs::create_dir_all.

Removes a directory at this path, after removing all its contents. See also std::fs::remove_dir_all.

Returns an iterator over the entries within a directory. See also std::fs::read_dir. TODO: async iterator impl?

Given a path, query the file system to get information about a file, directory, etc. See also std::fs::metadata.

Open the directory.

Implementors§