pub struct Directory { /* private fields */ }Expand description
A file source that reads files from a directory.
Will try to ignore files be default. See WalkBuilder
for more information.
Implementations§
Trait Implementations§
Source§impl<'files> FileSource<'files> for Directory
impl<'files> FileSource<'files> for Directory
type Entry = PathBuf
type Filepath = PathBuf
type Contents = Vec<u8>
Source§type State = ()
type State = ()
Sometimes it’s necessary to share a state between iterations to reduce
expensive commands.
type Iter = Iter
Source§fn entries(&'files self) -> Result<Self::Iter, Box<dyn ErrorTrait>>
fn entries(&'files self) -> Result<Self::Iter, Box<dyn ErrorTrait>>
Returns an iterator over the entries use to get filenames and contents.
Source§fn filepath(
&'files self,
entry: &Self::Entry,
_state: &mut Self::State,
) -> Result<Self::Filepath, Box<dyn ErrorTrait>>
fn filepath( &'files self, entry: &Self::Entry, _state: &mut Self::State, ) -> Result<Self::Filepath, Box<dyn ErrorTrait>>
Gets a filename from an entry.
Source§fn contents(
&'files self,
entry: &Self::Entry,
_state: &mut Self::State,
) -> Result<Self::Contents, Box<dyn ErrorTrait>>
fn contents( &'files self, entry: &Self::Entry, _state: &mut Self::State, ) -> Result<Self::Contents, Box<dyn ErrorTrait>>
Gets file contents from an entry.
Source§fn state(&'files self) -> Result<Self::State, Box<dyn ErrorTrait>>
fn state(&'files self) -> Result<Self::State, Box<dyn ErrorTrait>>
Gets a state that can be shared between iterations.
Source§fn overrides(
&self,
path: impl AsRef<Path>,
state: &mut Self::State,
) -> Overrides
fn overrides( &self, path: impl AsRef<Path>, state: &mut Self::State, ) -> Overrides
Provides combined overrides for the file.
Source§fn language_override(
&self,
_path: impl AsRef<Path>,
_state: &mut Self::State,
) -> Option<Language>
fn language_override( &self, _path: impl AsRef<Path>, _state: &mut Self::State, ) -> Option<Language>
Provides an optional override for the detected language.
Source§fn is_documentation_override(
&self,
_path: impl AsRef<Path>,
_state: &mut Self::State,
) -> Option<bool>
fn is_documentation_override( &self, _path: impl AsRef<Path>, _state: &mut Self::State, ) -> Option<bool>
Provides an optional override for documentation file detection.
Source§fn is_generated_override(
&self,
_path: impl AsRef<Path>,
_state: &mut Self::State,
) -> Option<bool>
fn is_generated_override( &self, _path: impl AsRef<Path>, _state: &mut Self::State, ) -> Option<bool>
Provides an optional override for generated file detection.
Auto Trait Implementations§
impl !Freeze for Directory
impl !RefUnwindSafe for Directory
impl Send for Directory
impl Sync for Directory
impl Unpin for Directory
impl !UnwindSafe for Directory
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