pub struct ModuleInliner {
path: PathBuf,
io_errs: IoErrs,
parse_errs: ParseErrs,
}Fields§
§path: PathBuf§io_errs: IoErrs§parse_errs: ParseErrsImplementations§
Source§impl ModuleInliner
impl ModuleInliner
Sourcepub fn new(root: impl AsRef<Path>) -> Self
pub fn new(root: impl AsRef<Path>) -> Self
Creates a new ModuleInliner
pub fn fork(&self, path: impl AsRef<Path>) -> Self
pub fn join(&mut self, other: ModuleInliner) -> &mut Self
pub fn main_path(&self) -> PathBuf
pub fn fallback_path(&self) -> Option<PathBuf>
Sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
Returns true when the ModuleInliner has errors to report
Sourcepub fn inline(self, expr: Expr) -> Result<Expr, (Expr, IoErrs, ParseErrs)>
pub fn inline(self, expr: Expr) -> Result<Expr, (Expr, IoErrs, ParseErrs)>
Traverses an Expr, attempting to inline all submodules.
This is a simple wrapper around ModuleInliner::fold_expr() and ModuleInliner::into_errs()
Sourcefn handle_io_error<T>(&mut self, path: PathBuf, error: Error) -> Option<T>
fn handle_io_error<T>(&mut self, path: PathBuf, error: Error) -> Option<T>
Records an I/O error for later
Sourcefn handle_parse_error<T>(
&mut self,
path: PathBuf,
error: ParseError,
) -> Option<T>
fn handle_parse_error<T>( &mut self, path: PathBuf, error: ParseError, ) -> Option<T>
Records a ParseError for later
Source§impl ModuleInliner
impl ModuleInliner
fn inline_file(&mut self) -> Option<Result<At<Expr>, Infallible>>
Sourcefn inline_file_at(&mut self, path: &str) -> Option<Result<At<Expr>, Infallible>>
fn inline_file_at(&mut self, path: &str) -> Option<Result<At<Expr>, Infallible>>
Inlines a file at the given path,
Trait Implementations§
Source§impl Fold<DefaultTypes> for ModuleInliner
impl Fold<DefaultTypes> for ModuleInliner
Source§fn fold_bind(
&mut self,
bind: Bind<DefaultTypes>,
) -> Result<Bind<DefaultTypes>, Self::Error>
fn fold_bind( &mut self, bind: Bind<DefaultTypes>, ) -> Result<Bind<DefaultTypes>, Self::Error>
Traverses down the module tree, entering ever nested directories
type Error = Infallible
Source§fn fold_annotation(&mut self, span: Span) -> Result<Span, Self::Error>
fn fold_annotation(&mut self, span: Span) -> Result<Span, Self::Error>
Consumes an Annotation in A, possibly transforms it, and produces a replacement Annotation
in B
Source§fn fold_macro_id(&mut self, name: Symbol) -> Result<Symbol, Self::Error>
fn fold_macro_id(&mut self, name: Symbol) -> Result<Symbol, Self::Error>
Consumes a
MacroId in A, possibly transforms it, and produces a replacement MacroId in BSource§fn fold_symbol(&mut self, name: Symbol) -> Result<Symbol, Self::Error>
fn fold_symbol(&mut self, name: Symbol) -> Result<Symbol, Self::Error>
Consumes a
Symbol in A, possibly transforms it, and produces a replacement Symbol in BSource§fn fold_path(&mut self, path: AstPath) -> Result<AstPath, Self::Error>
fn fold_path(&mut self, path: AstPath) -> Result<AstPath, Self::Error>
Consumes a
Path in A, possibly transforms it, and produces a replacement Path in BSource§fn fold_literal(&mut self, lit: Literal) -> Result<Literal, Self::Error>
fn fold_literal(&mut self, lit: Literal) -> Result<Literal, Self::Error>
Consumes a
Literal in A, possibly transforms it, and produces a replacement Literal in BSource§fn fold_at_expr(
&mut self,
expr: At<Expr<From>, From>,
) -> Result<At<Expr<To>, To>, Self::Error>
fn fold_at_expr( &mut self, expr: At<Expr<From>, From>, ) -> Result<At<Expr<To>, To>, Self::Error>
Folds an annotated expression, so the expression and annotation can be seen at once.
Auto Trait Implementations§
impl Freeze for ModuleInliner
impl !RefUnwindSafe for ModuleInliner
impl Send for ModuleInliner
impl Sync for ModuleInliner
impl Unpin for ModuleInliner
impl !UnwindSafe for ModuleInliner
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