pub struct Parser { /* private fields */ }
Implementations§
Source§impl Parser
impl Parser
Sourcepub fn from_files<P: AsRef<Path>, Q: AsRef<Path>>(
paths: impl Iterator<Item = P>,
root_path: Q,
) -> Result<Self>
pub fn from_files<P: AsRef<Path>, Q: AsRef<Path>>( paths: impl Iterator<Item = P>, root_path: Q, ) -> Result<Self>
Builds a parser from the given set of files, as well as any files they depend on, recursively.
TODO(aksiksi): Respect .gitignore and .ignore files via [ignore].
Sourcepub fn from_directory<P: AsRef<Path>>(path: P, ignore: bool) -> Result<Self>
pub fn from_directory<P: AsRef<Path>>(path: P, ignore: bool) -> Result<Self>
Recursively walks through all files in the given path and parses them.
If ignore is set, this method will respect .gitignore and .ignore files (via [ignore]).
Sourcepub fn on_change_blocks_in_file<P: AsRef<Path>>(
&self,
path: P,
) -> Option<impl Iterator<Item = &OnChangeBlock>>
pub fn on_change_blocks_in_file<P: AsRef<Path>>( &self, path: P, ) -> Option<impl Iterator<Item = &OnChangeBlock>>
Returns a iterator over all of the blocks in a specific file.
Sourcepub fn get_block_in_file<P: AsRef<Path>>(
&self,
path: P,
block_name: &str,
) -> Option<&OnChangeBlock>
pub fn get_block_in_file<P: AsRef<Path>>( &self, path: P, block_name: &str, ) -> Option<&OnChangeBlock>
Returns a iterator over all of the blocks in a specific file.
pub fn paths(&self) -> impl Iterator<Item = &Path>
pub fn root_path(&self) -> &Path
pub fn num_blocks(&self) -> usize
Source§impl Parser
impl Parser
Sourcepub fn from_git_repo<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn from_git_repo<P: AsRef<Path>>(path: P) -> Result<Self>
Builds a parser from staged files in a Git repo.
pub fn validate_git_repo(&self) -> Result<Vec<OnChangeViolation<'_>>>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Parser
impl RefUnwindSafe for Parser
impl Send for Parser
impl Sync for Parser
impl Unpin for Parser
impl UnwindSafe for Parser
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more