Struct Opcode
pub struct Opcode { /* private fields */ }
Expand description
A script Opcode.
We do not implement Ord on this type because there is no natural ordering on opcodes, but there
may appear to be one (e.g. because all the push opcodes appear in a consecutive block) and we
don’t want to encourage subtly buggy code. Please use Opcode::classify
to distinguish different
types of opcodes.
Example of Core bug caused by assuming ordering
Bitcoin Core’s IsPushOnly
considers OP_RESERVED
to be a “push code”, allowing this opcode
in contexts where only pushes are supposed to be allowed.
Implementations§
Trait Implementations§
§impl From<WitnessVersion> for Opcode
impl From<WitnessVersion> for Opcode
§fn from(version: WitnessVersion) -> Opcode
fn from(version: WitnessVersion) -> Opcode
Converts to this type from the input type.
§impl Serialize for Opcode
impl Serialize for Opcode
§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
§impl TryFrom<Opcode> for WitnessVersion
impl TryFrom<Opcode> for WitnessVersion
§type Error = TryFromError
type Error = TryFromError
The type returned in the event of a conversion error.
§fn try_from(
opcode: Opcode,
) -> Result<WitnessVersion, <WitnessVersion as TryFrom<Opcode>>::Error>
fn try_from( opcode: Opcode, ) -> Result<WitnessVersion, <WitnessVersion as TryFrom<Opcode>>::Error>
Performs the conversion.
impl Copy for Opcode
impl Eq for Opcode
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> 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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
Checks if this value is equivalent to the given key. Read more