pub trait FileOpener {
    type File;
    type Future: Future<Output = Result<FileWithMetadata<Self::File>, Error>>;

    fn open(&self, path: &Path) -> Self::Future;
}
Expand description

Trait for a simple virtual filesystem layer.

There is only the open operation, hence the name FileOpener. In practice, open must also collect some file metadata. (See the FileWithMetadata struct.)

In order to use an implementation with the other parts of this crate (ie. resolver and response builders), it must be marked Send and Sync, and must have 'static lifetime.

Required Associated Types§

File handle type.

In order to use files with the other parts of this crate, the file handle must implement the AsyncRead and AsyncSeek traits, must be marked Send and Unpin, and have 'static lifetime.

Future type that open returns.

This future must be marked Send in order to be used with other parts of this crate.

Required Methods§

Open a file and return a FileWithMetadata.

It can be assumed the path is already sanitized at this point.

Implementors§