pub trait ConfigRead {
// Required method
fn read(&self, path: &str) -> Result<Vec<u8>>;
}Expand description
Trait for reading configuration files from a filesystem or virtual filesystem.
Implement this to provide custom file access for environments where std::fs
is not available (e.g. no_std, sandboxed, or in-memory configurations).
Required Methods§
Sourcefn read(&self, path: &str) -> Result<Vec<u8>>
fn read(&self, path: &str) -> Result<Vec<u8>>
Read the entire contents of the configuration file at path, like std::fs::read.
A missing file must be reported as io::ErrorKind::NotFound; the configuration layer is
then treated as empty. Implementations should return io::ErrorKind::FileTooLarge for
files exceeding MAX_CONFIG_FILE_SIZE to avoid unnecessary allocations; the
configurator also checks the returned bytes as a safety net. Both are skipped with a
debug log, while any other error aborts config loading.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl ConfigRead for StdConfigRead
std only.