Struct foundry_compilers::flatten::Flattener
source · pub struct Flattener { /* private fields */ }
Expand description
Context for flattening. Stores all sources and ASTs that are in scope of the flattening target.
Implementations§
source§impl Flattener
impl Flattener
sourcepub fn new(
project: &Project,
output: &ProjectCompileOutput,
target: &Path
) -> Result<Self>
pub fn new( project: &Project, output: &ProjectCompileOutput, target: &Path ) -> Result<Self>
Compilation output is expected to contain all artifacts for all sources. Flattener caller is expected to resolve all imports of target file, compile them and pass into this function.
sourcepub fn flatten(&self) -> String
pub fn flatten(&self) -> String
Flattens target file and returns the result as a string
Flattening process includes following steps:
- Find all file-level definitions and rename references to them via aliased or qualified imports.
- Find all duplicates among file-level definitions and rename them to avoid conflicts.
- Remove all imports.
- Remove all pragmas except for the ones in the target file.
- Remove all license identifiers except for the one in the target file.
Auto Trait Implementations§
impl Freeze for Flattener
impl RefUnwindSafe for Flattener
impl Send for Flattener
impl Sync for Flattener
impl Unpin for Flattener
impl UnwindSafe for Flattener
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