pub trait Reporter: 'static + Debug {
    fn on_solc_spawn(
        &self,
        _solc: &Solc,
        _version: &Version,
        _input: &CompilerInput,
        _dirty_files: &[PathBuf]
    ) { ... } fn on_solc_success(
        &self,
        _solc: &Solc,
        _version: &Version,
        _output: &CompilerOutput,
        _duration: &Duration
    ) { ... } fn on_solc_installation_start(&self, _version: &Version) { ... } fn on_solc_installation_success(&self, _version: &Version) { ... } fn on_solc_installation_error(&self, _version: &Version, _error: &str) { ... } fn on_unresolved_imports(
        &self,
        _imports: &[(&Path, &Path)],
        _remappings: &[Remapping]
    ) { ... } unsafe fn downcast_raw(&self, id: TypeId) -> Option<NonNull<()>> { ... } }
Expand description

Trait representing the functions required to emit information about various steps in the compiler pipeline.

This trait provides a series of callbacks that are invoked at certain parts of the crate::Project::compile() process.

Implementers of this trait can use these callbacks to emit additional information, for example print custom messages to stdout.

A Reporter is entirely passive and only listens to incoming “events”.

Provided Methods§

Callback invoked right before Solc::compile() is called

This contains the Solc its Version the complete CompilerInput and all files that triggered the compile job. The dirty files are only provided to give a better feedback what was actually compiled.

If caching is enabled and there has been a previous successful solc run, the dirty files set contains the files that absolutely must be recompiled, while the CompilerInput contains all files, the dirty files and all their dependencies.

If this is a fresh compile then the crate::artifacts::Sources set of the CompilerInput matches the dirty files set.

Invoked with the CompilerOutput if Solc::compile() was successful

Invoked before a new Solc bin is installed

Invoked after a new Solc bin was successfully installed

Invoked after a Solc installation failed

Invoked if imports couldn’t be resolved with the given remappings, where imports is the list of all import paths and the file they occurred in: (import stmt, file)

If self is the same type as the provided TypeId, returns an untyped NonNull pointer to that type. Otherwise, returns None.

If you wish to downcast a Reporter, it is strongly advised to use the safe API provided by downcast_ref instead.

This API is required for downcast_raw to be a trait method; a method signature like downcast_ref (with a generic type parameter) is not object-safe, and thus cannot be a trait method for Reporter. This means that if we only exposed downcast_ref, Reporter implementations could not override the downcasting behavior

Safety

The downcast_ref method expects that the pointer returned by downcast_raw points to a valid instance of the type with the provided TypeId. Failure to ensure this will result in undefined behaviour, so implementing downcast_raw is unsafe.

Implementations§

Returns true if this Reporter is the same type as T.

Returns some reference to this Reporter value if it is of type T, or None if it isn’t.

Implementors§