pub struct Parser<'tu> { /* private fields */ }
Expand description
Parses translation units.
Implementations
sourceimpl<'tu> Parser<'tu>
impl<'tu> Parser<'tu>
sourcepub fn cache_completion_results(
&mut self,
cache_completion_results: bool
) -> &mut Parser<'tu>
pub fn cache_completion_results(
&mut self,
cache_completion_results: bool
) -> &mut Parser<'tu>
Sets whether certain code completion results will be cached when the translation unit is reparsed.
This option increases the time it takes to reparse the translation unit but improves code completion performance.
sourcepub fn detailed_preprocessing_record(
&mut self,
detailed_preprocessing_record: bool
) -> &mut Parser<'tu>
pub fn detailed_preprocessing_record(
&mut self,
detailed_preprocessing_record: bool
) -> &mut Parser<'tu>
Sets whether a detailed preprocessing record will be constructed which tracks all macro definitions and instantiations.
sourcepub fn briefs_in_completion_results(
&mut self,
briefs_in_completion_results: bool
) -> &mut Parser<'tu>
pub fn briefs_in_completion_results(
&mut self,
briefs_in_completion_results: bool
) -> &mut Parser<'tu>
Sets whether documentation comment briefs will be included in code completion results.
sourcepub fn incomplete(&mut self, incomplete: bool) -> &mut Parser<'tu>
pub fn incomplete(&mut self, incomplete: bool) -> &mut Parser<'tu>
Sets whether the translation unit will be considered incomplete.
This option suppresses certain semantic analyses and is typically used when parsing headers with the intent of creating a precompiled header.
sourcepub fn skip_function_bodies(
&mut self,
skip_function_bodies: bool
) -> &mut Parser<'tu>
pub fn skip_function_bodies(
&mut self,
skip_function_bodies: bool
) -> &mut Parser<'tu>
Sets whether function and method bodies will be skipped.
sourcepub fn keep_going(&mut self, keep_going: bool) -> &mut Parser<'tu>
pub fn keep_going(&mut self, keep_going: bool) -> &mut Parser<'tu>
Sets whether processing will continue after a fatal error is encountered.
sourcepub fn single_file_parse(&mut self, single_file_parse: bool) -> &mut Parser<'tu>
pub fn single_file_parse(&mut self, single_file_parse: bool) -> &mut Parser<'tu>
Sets whether incremental processing will be used.
sourcepub fn limit_skip_function_bodies_to_preamble(
&mut self,
limit_skip_function_bodies_to_preamble: bool
) -> &mut Parser<'tu>
pub fn limit_skip_function_bodies_to_preamble(
&mut self,
limit_skip_function_bodies_to_preamble: bool
) -> &mut Parser<'tu>
Sets whether function bodies will only be skipped in the preamble.
Used in conjunction with skip_function_bodies
.
sourcepub fn include_attributed_types(
&mut self,
include_attributed_types: bool
) -> &mut Parser<'tu>
pub fn include_attributed_types(
&mut self,
include_attributed_types: bool
) -> &mut Parser<'tu>
Sets whether attributed types should be included.
sourcepub fn visit_implicit_attributes(
&mut self,
visit_implicit_attributes: bool
) -> &mut Parser<'tu>
pub fn visit_implicit_attributes(
&mut self,
visit_implicit_attributes: bool
) -> &mut Parser<'tu>
Sets whether implicit attributes should be visited.
sourcepub fn ignore_non_errors_from_included_files(
&mut self,
ignore_non_errors_from_included_files: bool
) -> &mut Parser<'tu>
pub fn ignore_non_errors_from_included_files(
&mut self,
ignore_non_errors_from_included_files: bool
) -> &mut Parser<'tu>
Indicates that non-errors (e.g. warnings) from included files should be ignored.
sourcepub fn retain_excluded_conditional_blocks(
&mut self,
retain_excluded_conditional_blocks: bool
) -> &mut Parser<'tu>
pub fn retain_excluded_conditional_blocks(
&mut self,
retain_excluded_conditional_blocks: bool
) -> &mut Parser<'tu>
Sets whether the preprocessor will retain excluded conditional blocks.
sourceimpl<'tu> Parser<'tu>
impl<'tu> Parser<'tu>
sourcepub fn arguments<S: AsRef<str>>(&mut self, arguments: &[S]) -> &mut Parser<'tu>
pub fn arguments<S: AsRef<str>>(&mut self, arguments: &[S]) -> &mut Parser<'tu>
Sets the compiler arguments to provide to libclang
.
Any compiler argument that could be supplied to clang
may be supplied to this
function. However, the following arguments are ignored:
-c
-emit-ast
-fsyntax-only
-o
and the following<output>
sourcepub fn unsaved(&mut self, unsaved: &[Unsaved]) -> &mut Parser<'tu>
pub fn unsaved(&mut self, unsaved: &[Unsaved]) -> &mut Parser<'tu>
Sets the unsaved files to use.
sourcepub fn parse(&self) -> Result<TranslationUnit<'tu>, SourceError>
pub fn parse(&self) -> Result<TranslationUnit<'tu>, SourceError>
Parses a translation unit.
Failures
- an error occurs while deserializing an AST file
libclang
crashes- an unknown error occurs
Trait Implementations
Auto Trait Implementations
impl<'tu> RefUnwindSafe for Parser<'tu>
impl<'tu> !Send for Parser<'tu>
impl<'tu> !Sync for Parser<'tu>
impl<'tu> Unpin for Parser<'tu>
impl<'tu> UnwindSafe for Parser<'tu>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more