Struct syn_inline_mod::InlinerBuilder
source · pub struct InlinerBuilder { /* private fields */ }
Expand description
A builder that can configure how to inline modules.
After creating a builder, set configuration options using the methods
taking &mut self
, then parse and inline one or more files using
parse_and_inline_modules
.
Implementations§
source§impl InlinerBuilder
impl InlinerBuilder
sourcepub fn root(&mut self, root: bool) -> &mut Self
pub fn root(&mut self, root: bool) -> &mut Self
Configures whether the module being parsed is a root module or not.
A root module is one that is passed directly to rustc
. A non-root
module is one that is included from another module using a mod
item.
Default: true
.
sourcepub fn parse_and_inline_modules(
&self,
src_file: &Path
) -> Result<InliningResult, Error>
pub fn parse_and_inline_modules( &self, src_file: &Path ) -> Result<InliningResult, Error>
Parse the source code in src_file
and return an InliningResult
that has all modules
recursively inlined.
sourcepub fn inline_with_callback(
&self,
src_file: &Path,
on_load: impl FnMut(&Path, String)
) -> Result<InliningResult, Error>
pub fn inline_with_callback( &self, src_file: &Path, on_load: impl FnMut(&Path, String) ) -> Result<InliningResult, Error>
Parse the source code in src_file
and return an InliningResult
that has all modules
recursively inlined. Call the given callback whenever a file is loaded from disk (regardless
of if it parsed successfully).
Trait Implementations§
source§impl Debug for InlinerBuilder
impl Debug for InlinerBuilder
Auto Trait Implementations§
impl RefUnwindSafe for InlinerBuilder
impl Send for InlinerBuilder
impl Sync for InlinerBuilder
impl Unpin for InlinerBuilder
impl UnwindSafe for InlinerBuilder
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