pub struct ScriptChunk {
pub op: u8,
pub data: Option<Vec<u8>>,
}Expand description
A single parsed element of a Bitcoin script.
Each chunk is either a standalone opcode (like OP_DUP) or a data push that carries the opcode byte and the pushed data bytes.
Fields§
§op: u8The opcode byte. For direct pushes (1-75 bytes), this is the length.
data: Option<Vec<u8>>The data payload, if this chunk is a push operation.
Implementations§
Source§impl ScriptChunk
impl ScriptChunk
Sourcepub fn to_asm_string(&self) -> String
pub fn to_asm_string(&self) -> String
Convert this chunk to its ASM string representation.
Data push chunks are rendered as hex strings; non-push opcodes use their canonical OP_xxx name.
§Returns
A string suitable for inclusion in a space-separated ASM output.
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