Struct ethers_solc::artifacts::Source
source · pub struct Source {
pub content: Arc<String>,
}
Expand description
Content of a solidity file
This contains the actual source code of a file
Fields§
§content: Arc<String>
Content of the file
This is an Arc
because it may be cloned. If the Graph of the
project contains multiple conflicting versions then the same Source may be required by
conflicting versions and needs to be duplicated.
Implementations§
source§impl Source
impl Source
sourcepub fn new(content: impl Into<String>) -> Self
pub fn new(content: impl Into<String>) -> Self
Creates a new instance of Source with the given content.
sourcepub fn read_all_from(dir: impl AsRef<Path>) -> Result<Sources, SolcIoError>
pub fn read_all_from(dir: impl AsRef<Path>) -> Result<Sources, SolcIoError>
Recursively finds all source files under the given dir path and reads them all
sourcepub fn read_all_files(files: Vec<PathBuf>) -> Result<Sources, SolcIoError>
pub fn read_all_files(files: Vec<PathBuf>) -> Result<Sources, SolcIoError>
Reads all source files of the given vec
Depending on the len of the vec it will try to read the files in parallel
sourcepub fn read_all<T, I>(files: I) -> Result<Sources, SolcIoError>
pub fn read_all<T, I>(files: I) -> Result<Sources, SolcIoError>
Reads all files
sourcepub fn par_read_all<T, I>(files: I) -> Result<Sources, SolcIoError>
pub fn par_read_all<T, I>(files: I) -> Result<Sources, SolcIoError>
Parallelized version of Self::read_all
that reads all files using a parallel iterator
NOTE: this is only expected to be faster than Self::read_all
if the given iterator
contains at least several paths or the files are rather large.
sourcepub fn content_hash(&self) -> String
pub fn content_hash(&self) -> String
Generate a non-cryptographically secure checksum of the file’s content
sourcepub fn parse_imports(&self) -> Vec<&str>
pub fn parse_imports(&self) -> Vec<&str>
Returns all import statements of the file
source§impl Source
impl Source
sourcepub async fn async_read(file: impl AsRef<Path>) -> Result<Self, SolcIoError>
Available on crate feature async
only.
pub async fn async_read(file: impl AsRef<Path>) -> Result<Self, SolcIoError>
async
only.async version of Self::read
sourcepub async fn async_read_all_from(
dir: impl AsRef<Path>
) -> Result<Sources, SolcIoError>
Available on crate feature async
only.
pub async fn async_read_all_from( dir: impl AsRef<Path> ) -> Result<Sources, SolcIoError>
async
only.Finds all source files under the given dir path and reads them all
sourcepub async fn async_read_all<T, I>(files: I) -> Result<Sources, SolcIoError>
Available on crate feature async
only.
pub async fn async_read_all<T, I>(files: I) -> Result<Sources, SolcIoError>
async
only.async version of Self::read_all
Trait Implementations§
source§impl<'de> Deserialize<'de> for Source
impl<'de> Deserialize<'de> for Source
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl PartialEq for Source
impl PartialEq for Source
impl Eq for Source
impl StructuralPartialEq for Source
Auto Trait Implementations§
impl RefUnwindSafe for Source
impl Send for Source
impl Sync for Source
impl Unpin for Source
impl UnwindSafe for Source
Blanket Implementations§
source§impl<T, U> AsByteSlice<T> for U
impl<T, U> AsByteSlice<T> for U
fn as_byte_slice(&self) -> &[u8] ⓘ
source§impl<U> AsSliceOf for U
impl<U> AsSliceOf for U
fn as_slice_of<T>(&self) -> Result<&[T], Error>where
T: FromByteSlice,
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
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> ToHex for T
impl<T> ToHex for T
source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
self
into the result. Lower case
letters are used (e.g. f9b4ca
)source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
self
into the result. Upper case
letters are used (e.g. F9B4CA
)source§impl<T> ToHex for T
impl<T> ToHex for T
source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
ToHexExt
insteadself
into the result.
Lower case letters are used (e.g. f9b4ca
).source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
ToHexExt
insteadself
into the result.
Upper case letters are used (e.g. F9B4CA
).source§impl<T> ToHexExt for T
impl<T> ToHexExt for T
source§fn encode_hex(&self) -> String
fn encode_hex(&self) -> String
self
into the result.
Lower case letters are used (e.g. f9b4ca
).source§fn encode_hex_upper(&self) -> String
fn encode_hex_upper(&self) -> String
self
into the result.
Upper case letters are used (e.g. F9B4CA
).source§fn encode_hex_with_prefix(&self) -> String
fn encode_hex_with_prefix(&self) -> String
self
into the result with prefix 0x
.
Lower case letters are used (e.g. 0xf9b4ca
).source§fn encode_hex_upper_with_prefix(&self) -> String
fn encode_hex_upper_with_prefix(&self) -> String
self
into the result with prefix 0X
.
Upper case letters are used (e.g. 0xF9B4CA
).