pub struct File;Expand description
Loader for the file source: reads a single file or every file in a directory.
See the module docs for how names/formats are derived and how the ignore and
lowercase options behave. Stateless — construct with File::new.
§Example
use tanzim_load::{file::File, Load};
use tanzim_source::SourceBuilder;
// `ignore=[not-found]` turns a missing path into an empty result instead of an error,
// so this example is self-contained.
let source = SourceBuilder::new()
.with_source("file")
.with_resource("/path/to/config") // a file or a directory
.with_option("ignore", vec!["not-found"])
.build()
.unwrap();
let payloads = File::new().load(source).unwrap();
assert!(payloads.is_empty()); // nothing at that path, and not-found is ignoredImplementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for File
impl RefUnwindSafe for File
impl Send for File
impl Sync for File
impl Unpin for File
impl UnsafeUnpin for File
impl UnwindSafe for File
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more