revm_bytecode::opcode

Struct OpCode

Source
pub struct OpCode(/* private fields */);
Expand description

An EVM opcode.

This is always a valid opcode, as declared in the opcode module or the OPCODE_INFO constant.

Implementations§

Source§

impl OpCode

Source

pub fn parse(s: &str) -> Option<Self>

Parses an opcode from a string. This is the inverse of as_str.

Source§

impl OpCode

Source

pub const fn new(opcode: u8) -> Option<Self>

Instantiate a new opcode from a u8.

Source

pub const fn is_jumpdest(&self) -> bool

Returns true if the opcode is a jump destination.

Source

pub const fn is_jumpdest_by_op(opcode: u8) -> bool

Takes a u8 and returns true if it is a jump destination.

Source

pub const fn is_jump(self) -> bool

Returns true if the opcode is a legacy jump instruction.

Source

pub const fn is_jump_by_op(opcode: u8) -> bool

Takes a u8 and returns true if it is a jump instruction.

Source

pub const fn is_push(self) -> bool

Returns true if the opcode is a PUSH instruction.

Source

pub fn is_push_by_op(opcode: u8) -> bool

Takes a u8 and returns true if it is a push instruction.

Source

pub unsafe fn new_unchecked(opcode: u8) -> Self

Instantiate a new opcode from a u8 without checking if it is valid.

§Safety

All code using Opcode values assume that they are valid opcodes, so providing an invalid opcode may cause undefined behavior.

Source

pub const fn as_str(self) -> &'static str

Returns the opcode as a string. This is the inverse of parse.

Source

pub const fn name_by_op(opcode: u8) -> &'static str

Returns the opcode name.

Source

pub const fn inputs(&self) -> u8

Returns the number of input stack elements.

Source

pub const fn outputs(&self) -> u8

Returns the number of output stack elements.

Source

pub const fn io_diff(&self) -> i16

Calculates the difference between the number of input and output stack elements.

Source

pub const fn info_by_op(opcode: u8) -> Option<OpCodeInfo>

Returns the opcode information for the given opcode.

Source

pub const fn info(&self) -> OpCodeInfo

Returns the opcode information.

Source

pub const fn input_output(&self) -> (u8, u8)

Returns the number of both input and output stack elements.

Can be slightly faster that calling inputs and outputs separately.

Source

pub const fn get(self) -> u8

Returns the opcode as a u8.

Source

pub const fn modifies_memory(&self) -> bool

Source§

impl OpCode

Source

pub const STOP: Self = _

The 0x00 (“STOP”) opcode.

Source

pub const ADD: Self = _

The 0x01 (“ADD”) opcode.

Source

pub const MUL: Self = _

The 0x02 (“MUL”) opcode.

Source

pub const SUB: Self = _

The 0x03 (“SUB”) opcode.

Source

pub const DIV: Self = _

The 0x04 (“DIV”) opcode.

Source

pub const SDIV: Self = _

The 0x05 (“SDIV”) opcode.

Source

pub const MOD: Self = _

The 0x06 (“MOD”) opcode.

Source

pub const SMOD: Self = _

The 0x07 (“SMOD”) opcode.

Source

pub const ADDMOD: Self = _

The 0x08 (“ADDMOD”) opcode.

Source

pub const MULMOD: Self = _

The 0x09 (“MULMOD”) opcode.

Source

pub const EXP: Self = _

The 0x0A (“EXP”) opcode.

Source

pub const SIGNEXTEND: Self = _

The 0x0B (“SIGNEXTEND”) opcode.

Source

pub const LT: Self = _

The 0x10 (“LT”) opcode.

Source

pub const GT: Self = _

The 0x11 (“GT”) opcode.

Source

pub const SLT: Self = _

The 0x12 (“SLT”) opcode.

Source

pub const SGT: Self = _

The 0x13 (“SGT”) opcode.

Source

pub const EQ: Self = _

The 0x14 (“EQ”) opcode.

Source

pub const ISZERO: Self = _

The 0x15 (“ISZERO”) opcode.

Source

pub const AND: Self = _

The 0x16 (“AND”) opcode.

Source

pub const OR: Self = _

The 0x17 (“OR”) opcode.

Source

pub const XOR: Self = _

The 0x18 (“XOR”) opcode.

Source

pub const NOT: Self = _

The 0x19 (“NOT”) opcode.

Source

pub const BYTE: Self = _

The 0x1A (“BYTE”) opcode.

Source

pub const SHL: Self = _

The 0x1B (“SHL”) opcode.

Source

pub const SHR: Self = _

The 0x1C (“SHR”) opcode.

Source

pub const SAR: Self = _

The 0x1D (“SAR”) opcode.

Source

pub const KECCAK256: Self = _

The 0x20 (“KECCAK256”) opcode.

Source

pub const ADDRESS: Self = _

The 0x30 (“ADDRESS”) opcode.

Source

pub const BALANCE: Self = _

The 0x31 (“BALANCE”) opcode.

Source

pub const ORIGIN: Self = _

The 0x32 (“ORIGIN”) opcode.

Source

pub const CALLER: Self = _

The 0x33 (“CALLER”) opcode.

Source

pub const CALLVALUE: Self = _

The 0x34 (“CALLVALUE”) opcode.

Source

pub const CALLDATALOAD: Self = _

The 0x35 (“CALLDATALOAD”) opcode.

Source

pub const CALLDATASIZE: Self = _

The 0x36 (“CALLDATASIZE”) opcode.

Source

pub const CALLDATACOPY: Self = _

The 0x37 (“CALLDATACOPY”) opcode.

Source

pub const CODESIZE: Self = _

The 0x38 (“CODESIZE”) opcode.

Source

pub const CODECOPY: Self = _

The 0x39 (“CODECOPY”) opcode.

Source

pub const GASPRICE: Self = _

The 0x3A (“GASPRICE”) opcode.

Source

pub const EXTCODESIZE: Self = _

The 0x3B (“EXTCODESIZE”) opcode.

Source

pub const EXTCODECOPY: Self = _

The 0x3C (“EXTCODECOPY”) opcode.

Source

pub const RETURNDATASIZE: Self = _

The 0x3D (“RETURNDATASIZE”) opcode.

Source

pub const RETURNDATACOPY: Self = _

The 0x3E (“RETURNDATACOPY”) opcode.

Source

pub const EXTCODEHASH: Self = _

The 0x3F (“EXTCODEHASH”) opcode.

Source

pub const BLOCKHASH: Self = _

The 0x40 (“BLOCKHASH”) opcode.

Source

pub const COINBASE: Self = _

The 0x41 (“COINBASE”) opcode.

Source

pub const TIMESTAMP: Self = _

The 0x42 (“TIMESTAMP”) opcode.

Source

pub const NUMBER: Self = _

The 0x43 (“NUMBER”) opcode.

Source

pub const DIFFICULTY: Self = _

The 0x44 (“DIFFICULTY”) opcode.

Source

pub const GASLIMIT: Self = _

The 0x45 (“GASLIMIT”) opcode.

Source

pub const CHAINID: Self = _

The 0x46 (“CHAINID”) opcode.

Source

pub const SELFBALANCE: Self = _

The 0x47 (“SELFBALANCE”) opcode.

Source

pub const BASEFEE: Self = _

The 0x48 (“BASEFEE”) opcode.

Source

pub const BLOBHASH: Self = _

The 0x49 (“BLOBHASH”) opcode.

Source

pub const BLOBBASEFEE: Self = _

The 0x4A (“BLOBBASEFEE”) opcode.

Source

pub const POP: Self = _

The 0x50 (“POP”) opcode.

Source

pub const MLOAD: Self = _

The 0x51 (“MLOAD”) opcode.

Source

pub const MSTORE: Self = _

The 0x52 (“MSTORE”) opcode.

Source

pub const MSTORE8: Self = _

The 0x53 (“MSTORE8”) opcode.

Source

pub const SLOAD: Self = _

The 0x54 (“SLOAD”) opcode.

Source

pub const SSTORE: Self = _

The 0x55 (“SSTORE”) opcode.

Source

pub const JUMP: Self = _

The 0x56 (“JUMP”) opcode.

Source

pub const JUMPI: Self = _

The 0x57 (“JUMPI”) opcode.

Source

pub const PC: Self = _

The 0x58 (“PC”) opcode.

Source

pub const MSIZE: Self = _

The 0x59 (“MSIZE”) opcode.

Source

pub const GAS: Self = _

The 0x5A (“GAS”) opcode.

Source

pub const JUMPDEST: Self = _

The 0x5B (“JUMPDEST”) opcode.

Source

pub const TLOAD: Self = _

The 0x5C (“TLOAD”) opcode.

Source

pub const TSTORE: Self = _

The 0x5D (“TSTORE”) opcode.

Source

pub const MCOPY: Self = _

The 0x5E (“MCOPY”) opcode.

Source

pub const PUSH0: Self = _

The 0x5F (“PUSH0”) opcode.

Source

pub const PUSH1: Self = _

The 0x60 (“PUSH1”) opcode.

Source

pub const PUSH2: Self = _

The 0x61 (“PUSH2”) opcode.

Source

pub const PUSH3: Self = _

The 0x62 (“PUSH3”) opcode.

Source

pub const PUSH4: Self = _

The 0x63 (“PUSH4”) opcode.

Source

pub const PUSH5: Self = _

The 0x64 (“PUSH5”) opcode.

Source

pub const PUSH6: Self = _

The 0x65 (“PUSH6”) opcode.

Source

pub const PUSH7: Self = _

The 0x66 (“PUSH7”) opcode.

Source

pub const PUSH8: Self = _

The 0x67 (“PUSH8”) opcode.

Source

pub const PUSH9: Self = _

The 0x68 (“PUSH9”) opcode.

Source

pub const PUSH10: Self = _

The 0x69 (“PUSH10”) opcode.

Source

pub const PUSH11: Self = _

The 0x6A (“PUSH11”) opcode.

Source

pub const PUSH12: Self = _

The 0x6B (“PUSH12”) opcode.

Source

pub const PUSH13: Self = _

The 0x6C (“PUSH13”) opcode.

Source

pub const PUSH14: Self = _

The 0x6D (“PUSH14”) opcode.

Source

pub const PUSH15: Self = _

The 0x6E (“PUSH15”) opcode.

Source

pub const PUSH16: Self = _

The 0x6F (“PUSH16”) opcode.

Source

pub const PUSH17: Self = _

The 0x70 (“PUSH17”) opcode.

Source

pub const PUSH18: Self = _

The 0x71 (“PUSH18”) opcode.

Source

pub const PUSH19: Self = _

The 0x72 (“PUSH19”) opcode.

Source

pub const PUSH20: Self = _

The 0x73 (“PUSH20”) opcode.

Source

pub const PUSH21: Self = _

The 0x74 (“PUSH21”) opcode.

Source

pub const PUSH22: Self = _

The 0x75 (“PUSH22”) opcode.

Source

pub const PUSH23: Self = _

The 0x76 (“PUSH23”) opcode.

Source

pub const PUSH24: Self = _

The 0x77 (“PUSH24”) opcode.

Source

pub const PUSH25: Self = _

The 0x78 (“PUSH25”) opcode.

Source

pub const PUSH26: Self = _

The 0x79 (“PUSH26”) opcode.

Source

pub const PUSH27: Self = _

The 0x7A (“PUSH27”) opcode.

Source

pub const PUSH28: Self = _

The 0x7B (“PUSH28”) opcode.

Source

pub const PUSH29: Self = _

The 0x7C (“PUSH29”) opcode.

Source

pub const PUSH30: Self = _

The 0x7D (“PUSH30”) opcode.

Source

pub const PUSH31: Self = _

The 0x7E (“PUSH31”) opcode.

Source

pub const PUSH32: Self = _

The 0x7F (“PUSH32”) opcode.

Source

pub const DUP1: Self = _

The 0x80 (“DUP1”) opcode.

Source

pub const DUP2: Self = _

The 0x81 (“DUP2”) opcode.

Source

pub const DUP3: Self = _

The 0x82 (“DUP3”) opcode.

Source

pub const DUP4: Self = _

The 0x83 (“DUP4”) opcode.

Source

pub const DUP5: Self = _

The 0x84 (“DUP5”) opcode.

Source

pub const DUP6: Self = _

The 0x85 (“DUP6”) opcode.

Source

pub const DUP7: Self = _

The 0x86 (“DUP7”) opcode.

Source

pub const DUP8: Self = _

The 0x87 (“DUP8”) opcode.

Source

pub const DUP9: Self = _

The 0x88 (“DUP9”) opcode.

Source

pub const DUP10: Self = _

The 0x89 (“DUP10”) opcode.

Source

pub const DUP11: Self = _

The 0x8A (“DUP11”) opcode.

Source

pub const DUP12: Self = _

The 0x8B (“DUP12”) opcode.

Source

pub const DUP13: Self = _

The 0x8C (“DUP13”) opcode.

Source

pub const DUP14: Self = _

The 0x8D (“DUP14”) opcode.

Source

pub const DUP15: Self = _

The 0x8E (“DUP15”) opcode.

Source

pub const DUP16: Self = _

The 0x8F (“DUP16”) opcode.

Source

pub const SWAP1: Self = _

The 0x90 (“SWAP1”) opcode.

Source

pub const SWAP2: Self = _

The 0x91 (“SWAP2”) opcode.

Source

pub const SWAP3: Self = _

The 0x92 (“SWAP3”) opcode.

Source

pub const SWAP4: Self = _

The 0x93 (“SWAP4”) opcode.

Source

pub const SWAP5: Self = _

The 0x94 (“SWAP5”) opcode.

Source

pub const SWAP6: Self = _

The 0x95 (“SWAP6”) opcode.

Source

pub const SWAP7: Self = _

The 0x96 (“SWAP7”) opcode.

Source

pub const SWAP8: Self = _

The 0x97 (“SWAP8”) opcode.

Source

pub const SWAP9: Self = _

The 0x98 (“SWAP9”) opcode.

Source

pub const SWAP10: Self = _

The 0x99 (“SWAP10”) opcode.

Source

pub const SWAP11: Self = _

The 0x9A (“SWAP11”) opcode.

Source

pub const SWAP12: Self = _

The 0x9B (“SWAP12”) opcode.

Source

pub const SWAP13: Self = _

The 0x9C (“SWAP13”) opcode.

Source

pub const SWAP14: Self = _

The 0x9D (“SWAP14”) opcode.

Source

pub const SWAP15: Self = _

The 0x9E (“SWAP15”) opcode.

Source

pub const SWAP16: Self = _

The 0x9F (“SWAP16”) opcode.

Source

pub const LOG0: Self = _

The 0xA0 (“LOG0”) opcode.

Source

pub const LOG1: Self = _

The 0xA1 (“LOG1”) opcode.

Source

pub const LOG2: Self = _

The 0xA2 (“LOG2”) opcode.

Source

pub const LOG3: Self = _

The 0xA3 (“LOG3”) opcode.

Source

pub const LOG4: Self = _

The 0xA4 (“LOG4”) opcode.

Source

pub const DATALOAD: Self = _

The 0xD0 (“DATALOAD”) opcode.

Source

pub const DATALOADN: Self = _

The 0xD1 (“DATALOADN”) opcode.

Source

pub const DATASIZE: Self = _

The 0xD2 (“DATASIZE”) opcode.

Source

pub const DATACOPY: Self = _

The 0xD3 (“DATACOPY”) opcode.

Source

pub const RJUMP: Self = _

The 0xE0 (“RJUMP”) opcode.

Source

pub const RJUMPI: Self = _

The 0xE1 (“RJUMPI”) opcode.

Source

pub const RJUMPV: Self = _

The 0xE2 (“RJUMPV”) opcode.

Source

pub const CALLF: Self = _

The 0xE3 (“CALLF”) opcode.

Source

pub const RETF: Self = _

The 0xE4 (“RETF”) opcode.

Source

pub const JUMPF: Self = _

The 0xE5 (“JUMPF”) opcode.

Source

pub const DUPN: Self = _

The 0xE6 (“DUPN”) opcode.

Source

pub const SWAPN: Self = _

The 0xE7 (“SWAPN”) opcode.

Source

pub const EXCHANGE: Self = _

The 0xE8 (“EXCHANGE”) opcode.

Source

pub const EOFCREATE: Self = _

The 0xEC (“EOFCREATE”) opcode.

Source

pub const RETURNCONTRACT: Self = _

The 0xEE (“RETURNCONTRACT”) opcode.

Source

pub const CREATE: Self = _

The 0xF0 (“CREATE”) opcode.

Source

pub const CALL: Self = _

The 0xF1 (“CALL”) opcode.

Source

pub const CALLCODE: Self = _

The 0xF2 (“CALLCODE”) opcode.

Source

pub const RETURN: Self = _

The 0xF3 (“RETURN”) opcode.

Source

pub const DELEGATECALL: Self = _

The 0xF4 (“DELEGATECALL”) opcode.

Source

pub const CREATE2: Self = _

The 0xF5 (“CREATE2”) opcode.

Source

pub const RETURNDATALOAD: Self = _

The 0xF7 (“RETURNDATALOAD”) opcode.

Source

pub const EXTCALL: Self = _

The 0xF8 (“EXTCALL”) opcode.

Source

pub const EXTDELEGATECALL: Self = _

The 0xF9 (“EXTDELEGATECALL”) opcode.

Source

pub const STATICCALL: Self = _

The 0xFA (“STATICCALL”) opcode.

Source

pub const EXTSTATICCALL: Self = _

The 0xFB (“EXTSTATICCALL”) opcode.

Source

pub const REVERT: Self = _

The 0xFD (“REVERT”) opcode.

Source

pub const INVALID: Self = _

The 0xFE (“INVALID”) opcode.

Source

pub const SELFDESTRUCT: Self = _

The 0xFF (“SELFDESTRUCT”) opcode.

Trait Implementations§

Source§

impl Clone for OpCode

Source§

fn clone(&self) -> OpCode

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 OpCode

Source§

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

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

impl Default for OpCode

Source§

fn default() -> OpCode

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

impl Display for OpCode

Source§

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

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

impl FromStr for OpCode

Source§

type Err = OpCodeError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for OpCode

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for OpCode

Source§

fn cmp(&self, other: &OpCode) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for OpCode

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for OpCode

Source§

fn partial_cmp(&self, other: &OpCode) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for OpCode

Source§

impl Eq for OpCode

Source§

impl StructuralPartialEq for OpCode

Auto Trait Implementations§

§

impl Freeze for OpCode

§

impl RefUnwindSafe for OpCode

§

impl Send for OpCode

§

impl Sync for OpCode

§

impl Unpin for OpCode

§

impl UnwindSafe for OpCode

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
§

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

§

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

Checks if this value is equivalent to the given key. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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.

§

impl<T> Pipe for T
where T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.