pub struct VersionedSourceFiles(pub BTreeMap<String, Vec<VersionedSourceFile>>);
Expand description

(source_file path -> SourceFile + solc version)

Tuple Fields§

§0: BTreeMap<String, Vec<VersionedSourceFile>>

Implementations§

Converts all \\ separators in all paths to /

Returns an iterator over all files

Returns an iterator over the source files’ ids and path

use std::collections::BTreeMap;
use ethers_solc::sources::VersionedSourceFiles;
let sources: BTreeMap<u32,String> = files.into_ids().collect();

Returns an iterator over the source files’ paths and ids

use std::collections::BTreeMap;
use ethers_solc::artifacts::SourceFiles;
let sources :BTreeMap<String, u32> = files.into_paths().collect();

Returns an iterator over the source files’ ids and path

use std::collections::BTreeMap;
use semver::Version;
use ethers_solc::sources::VersionedSourceFiles;
let sources: BTreeMap<(u32, Version) ,String> = files.into_ids_with_version().map(|(id, source, version)|((id, version), source)).collect();

Finds the first source file with the given path

Example
use ethers_solc::Project;
use ethers_solc::artifacts::*;
let output = project.compile().unwrap().output();
let source_file = output.sources.find_file("src/Greeter.sol").unwrap();

Same as Self::find_file but also checks for version

Finds the first source file with the given id

Example
use ethers_solc::Project;
use ethers_solc::artifacts::*;
let output = project.compile().unwrap().output();
let source_file = output.sources.find_id(0).unwrap();

Same as Self::find_id but also checks for version

Removes the first source_file with the given path from the set

Example
use ethers_solc::Project;
use ethers_solc::artifacts::*;
let (mut sources, _) = project.compile().unwrap().output().split();
let source_file = sources.remove_by_path("src/Greeter.sol").unwrap();

Removes the first source_file with the given id from the set

Example
use ethers_solc::Project;
use ethers_solc::artifacts::*;
let (mut sources, _) = project.compile().unwrap().output().split();
let source_file = sources.remove_by_id(0).unwrap();

Iterate over all contracts and their names

Returns an iterator over (file, SourceFile, Version)

Returns an iterator over all contracts and their source names.

use std::collections::BTreeMap;
use ethers_solc::{ artifacts::* };
use ethers_solc::sources::VersionedSourceFiles;
let sources: BTreeMap<String, SourceFile> = sources
    .into_sources()
    .collect();

Returns an iterator over all contracts and their source names.

use std::collections::BTreeMap;
use semver::Version;
use ethers_solc::{ artifacts::* };
use ethers_solc::sources::VersionedSourceFiles;
let sources: BTreeMap<(String,Version), SourceFile> = sources
    .into_sources_with_version().map(|(path, source, version)|((path,version), source))
    .collect();

Sets the sources’ file paths to root adjoined to self.file.

Removes base from all source file paths

Trait Implementations§

Converts this type into a mutable reference of the (usually inferred) input type.
Converts this type into a shared reference of the (usually inferred) input type.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Deserialize this value from the given Serde deserializer. Read more
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.

Returns the argument unchanged.

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

Calls U::from(self).

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

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more