pub trait FileResolver:
Send
+ Sync
+ Debug {
// Required method
fn read<'a>(
&'a self,
file: &'a File,
max_bytes: u64,
) -> BoxFuture<'a, Result<FileBytes, FileError>>;
// Provided method
fn store<'a>(
&'a self,
name: &'a str,
mime_type: Option<&'a str>,
bytes: Vec<u8>,
) -> BoxFuture<'a, Result<File, FileError>> { ... }
}Expand description
Reads (and optionally stores) file content.
Required Methods§
Sourcefn read<'a>(
&'a self,
file: &'a File,
max_bytes: u64,
) -> BoxFuture<'a, Result<FileBytes, FileError>>
fn read<'a>( &'a self, file: &'a File, max_bytes: u64, ) -> BoxFuture<'a, Result<FileBytes, FileError>>
Read the whole file, failing with FileError::TooLarge past max_bytes.
Return FileError::Unsupported for files this resolver does not handle,
so a ChainResolver can try the next one.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".