pub enum BytecodeObject {
    Bytecode(Bytes),
    Unlinked(String),
}
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§

source§

impl BytecodeObject

source

pub fn into_bytes(self) -> Option<Bytes>

Returns the underlying Bytes if the object is a valid bytecode, and not empty

source

pub fn as_bytes(&self) -> Option<&Bytes>

Returns a reference to the underlying Bytes if the object is a valid bytecode, and not empty

source

pub fn bytes_len(&self) -> usize

Returns the number of bytes of the fully linked bytecode

Returns 0 if this object is unlinked.

source

pub fn as_str(&self) -> Option<&str>

Returns a reference to the underlying String if the object is unlinked

source

pub fn into_unlinked(self) -> Option<String>

Returns the unlinked String if the object is unlinked or empty

source

pub fn is_unlinked(&self) -> bool

Whether this object is still unlinked

source

pub fn is_bytecode(&self) -> bool

Whether this object a valid bytecode

source

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.

source

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

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

Link using the file and library names as fully qualified name <file>:<library> See BytecodeObject::link_fully_qualified

Links the bytecode object with all provided (file, lib, addr)

source

pub fn contains_fully_qualified_placeholder( &self, name: impl AsRef<str> ) -> bool

Whether the bytecode contains a matching placeholder using the qualified name

source

pub fn contains_placeholder( &self, file: impl AsRef<str>, library: impl AsRef<str> ) -> bool

Whether the bytecode contains a matching placeholder

Trait Implementations§

source§

impl AsRef<[u8]> for BytecodeObject

source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for BytecodeObject

source§

fn clone(&self) -> BytecodeObject

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for BytecodeObject

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for BytecodeObject

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for BytecodeObject

source§

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<BytecodeObject> for Bytecode

source§

fn from(object: BytecodeObject) -> Bytecode

Converts to this type from the input type.
source§

impl PartialEq<BytecodeObject> for BytecodeObject

source§

fn eq(&self, other: &BytecodeObject) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for BytecodeObject

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for BytecodeObject

source§

impl StructuralEq for BytecodeObject

source§

impl StructuralPartialEq for BytecodeObject

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T, U> AsByteSlice<T> for Uwhere T: ToByteSlice, U: AsRef<[T]> + ?Sized,

source§

fn as_byte_slice(&self) -> &[u8]

source§

impl<U> AsSliceOf for Uwhere U: AsRef<[u8]> + ?Sized,

source§

fn as_slice_of<T>(&self) -> Result<&[T], Error>where T: FromByteSlice,

source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

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

fn in_current_span(self) -> Instrumented<Self>

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

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> Pointable for T

source§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToHex for Twhere T: AsRef<[u8]>,

source§

fn encode_hex<U>(&self) -> Uwhere U: FromIterator<char>,

Encode the hex strict representing self into the result. Lower case letters are used (e.g. f9b4ca)
source§

fn encode_hex_upper<U>(&self) -> Uwhere U: FromIterator<char>,

Encode the hex strict representing self into the result. Upper case letters are used (e.g. F9B4CA)
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,

source§

impl<T> JsonSchemaMaybe for T