pub struct ParseFile<'a> {
pub input: &'a str,
}
Expand description
A structure representing a file to be parsed.
Fields§
§input: &'a str
Implementations§
Source§impl<'a> ParseFile<'a>
impl<'a> ParseFile<'a>
Sourcepub fn parse(&self) -> ParserResult<'_, Vec<Snippet>>
pub fn parse(&self) -> ParserResult<'_, Vec<Snippet>>
Parses the input file content and extracts snippets.
§Errors
This function may return an error if it fails to parse the input file. Other errors encountered during parsing will be logged.
Sourcepub fn inject(
&self,
snippets: &HashMap<String, &DbDataSnippet>,
) -> ParserResult<'_, InjectSummary>
pub fn inject( &self, snippets: &HashMap<String, &DbDataSnippet>, ) -> ParserResult<'_, InjectSummary>
Sourcepub fn get_attributes(tag: &str) -> ParserResult<'_, BTreeMap<String, String>>
pub fn get_attributes(tag: &str) -> ParserResult<'_, BTreeMap<String, String>>
Extracts the attributes from the given HTML tag.
For Example:
- The given tag is
<snipgrep id="quick_start">
the result will be {“id”: “quick_start
”}
§Errors
This function returns an error in the following cases:
- The tag is not of type
snipgrep
. - The tag cannot be parsed.
Auto Trait Implementations§
impl<'a> Freeze for ParseFile<'a>
impl<'a> RefUnwindSafe for ParseFile<'a>
impl<'a> Send for ParseFile<'a>
impl<'a> Sync for ParseFile<'a>
impl<'a> Unpin for ParseFile<'a>
impl<'a> UnwindSafe for ParseFile<'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