Struct ethers_solc::project_util::mock::MockProjectGenerator
source · pub struct MockProjectGenerator { /* private fields */ }
project-util
only.Expand description
Represents a virtual project
Implementations§
source§impl MockProjectGenerator
impl MockProjectGenerator
sourcepub fn new(settings: &MockProjectSettings) -> Self
pub fn new(settings: &MockProjectSettings) -> Self
Create a new project and populate it using the given settings
sourcepub fn create(paths: &ProjectPathsConfig) -> Result<Self>
pub fn create(paths: &ProjectPathsConfig) -> Result<Self>
Create a skeleton of a real project
sourcepub fn into_inner(self) -> MockProjectSkeleton
pub fn into_inner(self) -> MockProjectSkeleton
Consumes the type and returns the underlying skeleton
sourcepub fn write_to(
&self,
paths: &ProjectPathsConfig,
version: impl AsRef<str>
) -> Result<()>
pub fn write_to( &self, paths: &ProjectPathsConfig, version: impl AsRef<str> ) -> Result<()>
Generate all solidity files and write under the paths config
sourcepub fn remappings_at(&self, root: &Path) -> Vec<Remapping>
pub fn remappings_at(&self, root: &Path) -> Vec<Remapping>
Returns all the remappings for the project for the given root path
sourcepub fn remappings(&self) -> Vec<Remapping>
pub fn remappings(&self) -> Vec<Remapping>
Returns all the remappings for the project
sourcepub fn populate(&mut self, settings: &MockProjectSettings) -> &mut Self
pub fn populate(&mut self, settings: &MockProjectSettings) -> &mut Self
Adds sources and libraries and populates imports based on the settings
sourcepub fn add_source(&mut self) -> &mut Self
pub fn add_source(&mut self) -> &mut Self
Adds a new source file
sourcepub fn add_sources(&mut self, num: usize) -> &mut Self
pub fn add_sources(&mut self, num: usize) -> &mut Self
Adds num
new source files
sourcepub fn add_lib_file(&mut self, lib_id: usize) -> &mut Self
pub fn add_lib_file(&mut self, lib_id: usize) -> &mut Self
Adds a new lib file
sourcepub fn add_lib_files(&mut self, num: usize, lib_id: usize) -> &mut Self
pub fn add_lib_files(&mut self, num: usize, lib_id: usize) -> &mut Self
Adds num
new source files
sourcepub fn add_lib(&mut self, num_files: usize) -> &mut Self
pub fn add_lib(&mut self, num_files: usize) -> &mut Self
Adds a new lib with the number of lib files
sourcepub fn assign_empty_files(&mut self) -> &mut Self
pub fn assign_empty_files(&mut self) -> &mut Self
randomly assign empty file status so that mocked files don’t emit artifacts
sourcepub fn populate_imports(&mut self, settings: &MockProjectSettings) -> &mut Self
pub fn populate_imports(&mut self, settings: &MockProjectSettings) -> &mut Self
Populates the imports of the project
sourcepub fn used_file_ids(&self) -> impl Iterator<Item = usize> + '_
pub fn used_file_ids(&self) -> impl Iterator<Item = usize> + '_
Returns an iterator over all file ids that are source files or imported by source files
In other words, all files that are relevant in order to compile the project’s source files.
sourcepub fn internal_file_ids(&self) -> impl Iterator<Item = usize> + '_
pub fn internal_file_ids(&self) -> impl Iterator<Item = usize> + '_
All ids of internal files
sourcepub fn external_file_ids(&self) -> impl Iterator<Item = usize> + '_
pub fn external_file_ids(&self) -> impl Iterator<Item = usize> + '_
All ids of external files
sourcepub fn modify_file(
&self,
id: usize,
paths: &ProjectPathsConfig,
version: impl AsRef<str>
) -> Result<PathBuf>
pub fn modify_file( &self, id: usize, paths: &ProjectPathsConfig, version: impl AsRef<str> ) -> Result<PathBuf>
Modifies the content of the given file