ScriptPubkeyExt

Trait ScriptPubkeyExt 

Source
pub trait ScriptPubkeyExt: AsPtr<btck_ScriptPubkey> {
    // Provided method
    fn to_bytes(&self) -> Vec<u8>  { ... }
}
Expand description

Common operations for script pubkeys, implemented by both owned and borrowed types.

This trait provides shared functionality for ScriptPubkey and ScriptPubkeyRef, allowing code to work with either owned or borrowed script pubkeys.

Provided Methods§

Source

fn to_bytes(&self) -> Vec<u8>

Serializes the script to raw bytes.

Returns the script’s raw byte representation.

§Examples
let script = ScriptPubkey::new(&[0x76, 0xa9]).unwrap();
let bytes = script.to_bytes();
assert_eq!(bytes, vec![0x76, 0xa9]);

Implementors§