Enum ethers_solc::artifacts::bytecode::BytecodeObject
source · [−]Expand description
Represents the bytecode of a contracts that might be not fully linked yet.
Variants
Bytecode(Bytes)
Fully linked bytecode object
Unlinked(String)
Bytecode as hex string that’s not fully linked yet and contains library placeholders
Implementations
sourceimpl BytecodeObject
impl BytecodeObject
sourcepub fn into_bytes(self) -> Option<Bytes>
pub fn into_bytes(self) -> Option<Bytes>
Returns the underlying Bytes if the object is a valid bytecode, and not empty
sourcepub fn as_bytes(&self) -> Option<&Bytes>
pub fn as_bytes(&self) -> Option<&Bytes>
Returns a reference to the underlying Bytes if the object is a valid bytecode, and not
empty
sourcepub fn bytes_len(&self) -> usize
pub fn bytes_len(&self) -> usize
Returns the number of bytes of the fully linked bytecode
Returns 0 if this object is unlinked.
sourcepub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
Returns a reference to the underlying String if the object is unlinked
sourcepub fn into_unlinked(self) -> Option<String>
pub fn into_unlinked(self) -> Option<String>
Returns the unlinked String if the object is unlinked or empty
sourcepub fn is_unlinked(&self) -> bool
pub fn is_unlinked(&self) -> bool
Whether this object is still unlinked
sourcepub fn is_bytecode(&self) -> bool
pub fn is_bytecode(&self) -> bool
Whether this object a valid bytecode
sourcepub fn is_non_empty_bytecode(&self) -> bool
pub fn is_non_empty_bytecode(&self) -> bool
Returns true if the object is a valid bytecode and not empty.
Returns false the object is a valid but empty bytecode or unlinked.
sourcepub fn resolve(&mut self) -> Option<&Bytes>
pub fn resolve(&mut self) -> Option<&Bytes>
Tries to resolve the unlinked string object a valid bytecode object in place
Returns the string if it is a valid
sourcepub fn link_fully_qualified(
&mut self,
name: impl AsRef<str>,
addr: Address
) -> &mut Self
pub fn link_fully_qualified(
&mut self,
name: impl AsRef<str>,
addr: Address
) -> &mut Self
Link using the fully qualified name of a library
The fully qualified library name is the path of its source file and the library name
separated by : like file.sol:Math
This will replace all occurrences of the library placeholder with the given address.
See also: https://docs.soliditylang.org/en/develop/using-the-compiler.html#library-linking
sourcepub fn link(
&mut self,
file: impl AsRef<str>,
library: impl AsRef<str>,
addr: Address
) -> &mut Self
pub fn link(
&mut self,
file: impl AsRef<str>,
library: impl AsRef<str>,
addr: Address
) -> &mut Self
Link using the file and library names as fully qualified name <file>:<library>
See BytecodeObject::link_fully_qualified
sourcepub fn link_all<I, S, T>(&mut self, libs: I) -> &mut Self where
I: IntoIterator<Item = (S, T, Address)>,
S: AsRef<str>,
T: AsRef<str>,
pub fn link_all<I, S, T>(&mut self, libs: I) -> &mut Self where
I: IntoIterator<Item = (S, T, Address)>,
S: AsRef<str>,
T: AsRef<str>,
Links the bytecode object with all provided (file, lib, addr)
sourcepub fn contains_fully_qualified_placeholder(
&self,
name: impl AsRef<str>
) -> bool
pub fn contains_fully_qualified_placeholder(
&self,
name: impl AsRef<str>
) -> bool
Whether the bytecode contains a matching placeholder using the qualified name
Trait Implementations
sourceimpl Clone for BytecodeObject
impl Clone for BytecodeObject
sourcefn clone(&self) -> BytecodeObject
fn clone(&self) -> BytecodeObject
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for BytecodeObject
impl Debug for BytecodeObject
sourceimpl Default for BytecodeObject
impl Default for BytecodeObject
sourceimpl<'de> Deserialize<'de> for BytecodeObject
impl<'de> Deserialize<'de> for BytecodeObject
sourcefn 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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<BytecodeObject> for Bytecode
impl From<BytecodeObject> for Bytecode
sourcefn from(object: BytecodeObject) -> Bytecode
fn from(object: BytecodeObject) -> Bytecode
Converts to this type from the input type.
sourceimpl PartialEq<BytecodeObject> for BytecodeObject
impl PartialEq<BytecodeObject> for BytecodeObject
sourcefn eq(&self, other: &BytecodeObject) -> bool
fn eq(&self, other: &BytecodeObject) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &BytecodeObject) -> bool
fn ne(&self, other: &BytecodeObject) -> bool
This method tests for !=.
sourceimpl Serialize for BytecodeObject
impl Serialize for BytecodeObject
impl Eq for BytecodeObject
impl StructuralEq for BytecodeObject
impl StructuralPartialEq for BytecodeObject
Auto Trait Implementations
impl RefUnwindSafe for BytecodeObject
impl Send for BytecodeObject
impl Sync for BytecodeObject
impl Unpin for BytecodeObject
impl UnwindSafe for BytecodeObject
Blanket Implementations
impl<U> AsSliceOf for U where
U: AsRef<[u8]> + ?Sized,
impl<U> AsSliceOf for U where
U: AsRef<[u8]> + ?Sized,
fn as_slice_of<T>(&self) -> Result<&[T], Error> where
T: FromByteSlice,
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToHex for T where
T: AsRef<[u8]>,
impl<T> ToHex for T where
T: AsRef<[u8]>,
sourcefn encode_hex<U>(&self) -> U where
U: FromIterator<char>,
fn encode_hex<U>(&self) -> U where
U: FromIterator<char>,
Encode the hex strict representing self into the result. Lower case
letters are used (e.g. f9b4ca) Read more
sourcefn encode_hex_upper<U>(&self) -> U where
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> U where
U: FromIterator<char>,
Encode the hex strict representing self into the result. Upper case
letters are used (e.g. F9B4CA) Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more