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 Copy for Opcode
impl Eq for Opcode
Source§impl From<WitnessVersion> for Opcode
impl From<WitnessVersion> for Opcode
Source§fn from(version: WitnessVersion) -> Opcode
fn from(version: WitnessVersion) -> Opcode
Converts to this type from the input type.
Source§impl Serialize for Opcode
Available on crate feature serde only.
impl Serialize for Opcode
Available on crate feature
serde only.Source§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 StructuralPartialEq for Opcode
Source§impl TryFrom<Opcode> for WitnessVersion
impl TryFrom<Opcode> for WitnessVersion
Source§type Error = TryFromError
type Error = TryFromError
The type returned in the event of a conversion error.
Source§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.
Auto Trait Implementations§
impl Freeze for Opcode
impl RefUnwindSafe for Opcode
impl Send for Opcode
impl Sync for Opcode
impl Unpin for Opcode
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.