pub enum PushOpcode {
Push1,
Push2,
Push3,
}Expand description
Push opcode for jump instructions
Variants§
Push1
PUSH1 opcode (0x60) - pushes 1 byte onto stack
Push2
PUSH2 opcode (0x61) - pushes 2 bytes onto stack
Push3
PUSH3 opcode (0x62) - pushes 3 bytes onto stack; needed for offsets beyond 64 KiB, which initcode can reach from Amsterdam (EIP-7954)
Implementations§
Source§impl PushOpcode
impl PushOpcode
Sourcepub fn byte_size(&self) -> usize
pub fn byte_size(&self) -> usize
Get the number of bytes this push opcode accepts (not including the opcode itself)
Sourcepub fn can_represent(&self, value: usize) -> bool
pub fn can_represent(&self, value: usize) -> bool
Check if a value can be represented by this push opcode
Sourcepub fn optimal_for(value: usize) -> Self
pub fn optimal_for(value: usize) -> Self
Get the optimal push opcode for a given value
Sourcepub fn format_value(&self, value: usize) -> String
pub fn format_value(&self, value: usize) -> String
Formats a value as the zero-padded push data of this opcode
Trait Implementations§
Source§impl Clone for PushOpcode
impl Clone for PushOpcode
impl Copy for PushOpcode
Source§impl Debug for PushOpcode
impl Debug for PushOpcode
impl Eq for PushOpcode
Source§impl Ord for PushOpcode
impl Ord for PushOpcode
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for PushOpcode
impl PartialEq for PushOpcode
Source§impl PartialOrd for PushOpcode
impl PartialOrd for PushOpcode
impl StructuralPartialEq for PushOpcode
Auto Trait Implementations§
impl Freeze for PushOpcode
impl RefUnwindSafe for PushOpcode
impl Send for PushOpcode
impl Sync for PushOpcode
impl Unpin for PushOpcode
impl UnsafeUnpin for PushOpcode
impl UnwindSafe for PushOpcode
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
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> ⓘ
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 moreSource§impl<S, T> Upcast<T> for S
impl<S, T> Upcast<T> for S
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn 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>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 1 byte
Size for each variant:
Push1: 0 bytesPush2: 0 bytesPush3: 0 bytes