pub struct ScriptChunk {
pub op: Op,
pub op_byte: u8,
pub data: Option<Vec<u8>>,
}Expand description
A single parsed element of a script.
Fields§
§op: OpThe opcode. For direct pushes (0x01..=0x4b) this is the raw byte
cast via Op::from, which gives OpInvalidOpcode. The parser
stores the raw byte value as op_byte instead.
op_byte: u8For push operations this carries the raw opcode byte (which may be a direct-push length 0x01..=0x4b that has no named Op variant).
data: Option<Vec<u8>>The pushed data, if any.
Implementations§
Source§impl ScriptChunk
impl ScriptChunk
Sourcepub fn new_opcode(op: Op) -> Self
pub fn new_opcode(op: Op) -> Self
Create a new chunk with just an opcode (no data).
Sourcepub fn new_raw(op_byte: u8, data: Option<Vec<u8>>) -> Self
pub fn new_raw(op_byte: u8, data: Option<Vec<u8>>) -> Self
Create a new chunk from a raw opcode byte and optional data.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Whether the chunk has a non-zero serialized length (always true).
Trait Implementations§
Source§impl Clone for ScriptChunk
impl Clone for ScriptChunk
Source§fn clone(&self) -> ScriptChunk
fn clone(&self) -> ScriptChunk
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ScriptChunk
impl Debug for ScriptChunk
Source§impl PartialEq for ScriptChunk
impl PartialEq for ScriptChunk
impl Eq for ScriptChunk
impl StructuralPartialEq for ScriptChunk
Auto Trait Implementations§
impl Freeze for ScriptChunk
impl RefUnwindSafe for ScriptChunk
impl Send for ScriptChunk
impl Sync for ScriptChunk
impl Unpin for ScriptChunk
impl UnsafeUnpin for ScriptChunk
impl UnwindSafe for ScriptChunk
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