Struct foundry_compilers::artifacts::bytecode::CompactBytecode
source · pub struct CompactBytecode {
pub object: BytecodeObject,
pub source_map: Option<String>,
pub link_references: BTreeMap<String, BTreeMap<String, Vec<Offsets>>>,
}Fields§
§object: BytecodeObjectThe bytecode as a hex string.
source_map: Option<String>The source mapping as a string. See the source mapping definition.
link_references: BTreeMap<String, BTreeMap<String, Vec<Offsets>>>If given, this is an unlinked object.
Implementations§
source§impl CompactBytecode
impl CompactBytecode
sourcepub fn empty() -> Self
pub fn empty() -> Self
Returns a new CompactBytecode object that contains nothing, as it’s the case for
interfaces and standalone solidity files that don’t contain any contract definitions
sourcepub fn source_map(&self) -> Option<Result<SourceMap, SyntaxError>>
pub fn source_map(&self) -> Option<Result<SourceMap, SyntaxError>>
Returns the parsed source map
See also https://docs.soliditylang.org/en/v0.8.10/internals/source_mappings.html
sourcepub fn link(
&mut self,
file: impl AsRef<str>,
library: impl AsRef<str>,
address: Address
) -> bool
pub fn link( &mut self, file: impl AsRef<str>, library: impl AsRef<str>, address: Address ) -> bool
Tries to link the bytecode object with the file and library name.
Replaces all library placeholders with the given address.
Returns true if the bytecode object is fully linked, false otherwise This is a noop if the bytecode object is already fully linked.
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.
Trait Implementations§
source§impl Clone for CompactBytecode
impl Clone for CompactBytecode
source§fn clone(&self) -> CompactBytecode
fn clone(&self) -> CompactBytecode
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for CompactBytecode
impl Debug for CompactBytecode
source§impl<'de> Deserialize<'de> for CompactBytecode
impl<'de> Deserialize<'de> for CompactBytecode
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>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<Bytecode> for CompactBytecode
impl From<Bytecode> for CompactBytecode
source§fn from(bcode: Bytecode) -> CompactBytecode
fn from(bcode: Bytecode) -> CompactBytecode
Converts to this type from the input type.
source§impl From<CompactBytecode> for Bytecode
impl From<CompactBytecode> for Bytecode
source§fn from(bcode: CompactBytecode) -> Bytecode
fn from(bcode: CompactBytecode) -> Bytecode
Converts to this type from the input type.
source§impl PartialEq for CompactBytecode
impl PartialEq for CompactBytecode
source§fn eq(&self, other: &CompactBytecode) -> bool
fn eq(&self, other: &CompactBytecode) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl Serialize for CompactBytecode
impl Serialize for CompactBytecode
impl Eq for CompactBytecode
impl StructuralPartialEq for CompactBytecode
Auto Trait Implementations§
impl !Freeze for CompactBytecode
impl RefUnwindSafe for CompactBytecode
impl Send for CompactBytecode
impl Sync for CompactBytecode
impl Unpin for CompactBytecode
impl UnwindSafe for CompactBytecode
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
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> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more