Skip to main content

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>

Instantiates a new opcode from a u8.

Returns None if the opcode is not valid.

Source

pub const fn new_or_unknown(opcode: u8) -> Self

Instantiates 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 PUSH1..=PUSH32 instruction.

Source

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

Returns true if the opcode is a PUSH1..=PUSH32 instruction.

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. Check OpCodeInfo for more information.

Source

pub const fn as_usize(&self) -> usize

Returns the opcode as a usize.

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 than 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

pub const fn is_valid(&self) -> bool

Returns true if the opcode is valid

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 CLZ: Self

The 0x1E (“CLZ”) 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 SLOTNUM: Self

The 0x4B (“SLOTNUM”) 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 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 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 STATICCALL: Self

The 0xFA (“STATICCALL”) 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 duplicate 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 opcode as a string

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<u8> for OpCode

Source§

fn eq(&self, other: &u8) -> 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 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§

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, dest: *mut u8)

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

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

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

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

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§

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.