pub struct MockProjectGenerator { /* private fields */ }
Available on crate feature project-util only.
Expand description

Represents a virtual project

Implementations§

source§

impl MockProjectGenerator

source

pub fn new(settings: &MockProjectSettings) -> Self

Create a new project and populate it using the given settings

source

pub fn create(paths: &ProjectPathsConfig) -> Result<Self>

Create a skeleton of a real project

source

pub fn into_inner(self) -> MockProjectSkeleton

Consumes the type and returns the underlying skeleton

source

pub fn write_to( &self, paths: &ProjectPathsConfig, version: impl AsRef<str> ) -> Result<()>

Generate all solidity files and write under the paths config

source

pub fn remappings_at(&self, root: &Path) -> Vec<Remapping>

Returns all the remappings for the project for the given root path

source

pub fn remappings(&self) -> Vec<Remapping>

Returns all the remappings for the project

source

pub fn random() -> Self

Generates a random project with random settings

source

pub fn populate(&mut self, settings: &MockProjectSettings) -> &mut Self

Adds sources and libraries and populates imports based on the settings

source

pub fn add_source(&mut self) -> &mut Self

Adds a new source file

source

pub fn add_sources(&mut self, num: usize) -> &mut Self

Adds num new source files

source

pub fn add_lib_file(&mut self, lib_id: usize) -> &mut Self

Adds a new lib file

source

pub fn add_lib_files(&mut self, num: usize, lib_id: usize) -> &mut Self

Adds num new source files

source

pub fn add_lib(&mut self, num_files: usize) -> &mut Self

Adds a new lib with the number of lib files

source

pub fn assign_empty_files(&mut self) -> &mut Self

randomly assign empty file status so that mocked files don’t emit artifacts

source

pub fn populate_imports(&mut self, settings: &MockProjectSettings) -> &mut Self

Populates the imports of the project

source

pub fn get_file(&self, id: usize) -> &MockFile

Returns the file for the given id

source

pub fn file_ids(&self) -> impl Iterator<Item = usize> + '_

All file ids

source

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.

source

pub fn internal_file_ids(&self) -> impl Iterator<Item = usize> + '_

All ids of internal files

source

pub fn external_file_ids(&self) -> impl Iterator<Item = usize> + '_

All ids of external files

source

pub fn modify_file( &self, id: usize, paths: &ProjectPathsConfig, version: impl AsRef<str> ) -> Result<PathBuf>

Modifies the content of the given file

Trait Implementations§

source§

impl Default for MockProjectGenerator

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl From<MockProjectSkeleton> for MockProjectGenerator

source§

fn from(inner: MockProjectSkeleton) -> Self

Converts to this type from the input type.
source§

impl Serialize for MockProjectGenerator

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> JsonSchemaMaybe for T