pub struct Injector<'a> {
pub base_folder: &'a Path,
pub input: &'a str,
pub config: &'a InjectConfig,
pub db_data: &'a DBData,
}
Fields§
§base_folder: &'a Path
§input: &'a str
§config: &'a InjectConfig
§db_data: &'a DBData
Implementations§
Source§impl<'a> Injector<'a>
impl<'a> Injector<'a>
Sourcepub const fn new(
base_folder: &'a Path,
input: &'a str,
config: &'a InjectConfig,
db_data: &'a DBData,
) -> Self
pub const fn new( base_folder: &'a Path, input: &'a str, config: &'a InjectConfig, db_data: &'a DBData, ) -> Self
Constructs a new [ParseFile
] with the provided input.
Sourcepub fn walk(
walk: &Walk,
db_data: &DBData,
config: &InjectConfig,
) -> InjectorResult
pub fn walk( walk: &Walk, db_data: &DBData, config: &InjectConfig, ) -> InjectorResult
Constructs a Collector
instance by collecting snippets from files
within the provided Walk
.
Sourcepub fn inject(
base_folder: &Path,
input: &str,
config: &InjectConfig,
db_data: &DBData,
) -> InjectedContent
pub fn inject( base_folder: &Path, input: &str, config: &InjectConfig, db_data: &DBData, ) -> InjectedContent
§Returns
Returns Some
containing the collected snippets if successful,
otherwise returns None
.
Sourcepub fn run(&self) -> ParserResult<'_, InjectSummary>
pub fn run(&self) -> ParserResult<'_, InjectSummary>
Injects snippets in the input file content based on the provided
[Snippet
] map.
§Errors
This function may return an error if it fails to parse the input file. Other errors encountered during parsing will be logged.
Auto Trait Implementations§
impl<'a> Freeze for Injector<'a>
impl<'a> RefUnwindSafe for Injector<'a>
impl<'a> Send for Injector<'a>
impl<'a> Sync for Injector<'a>
impl<'a> Unpin for Injector<'a>
impl<'a> UnwindSafe for Injector<'a>
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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