pub enum NativeScript {
ScriptPubkey(AddrKeyhash),
ScriptAll(Vec<NativeScript>),
ScriptAny(Vec<NativeScript>),
ScriptNOfK(i64, Vec<NativeScript>),
InvalidBefore(u64),
InvalidHereafter(u64),
}Expand description
A native script tree with stack-safe CBOR, clone, equality and drop operations.
This type implements Drop to dismantle deep trees iteratively. To consume
a child list, match by mutable reference and use std::mem::take. This
stack-safety guarantee does not cover Serde, debug formatting or downstream
tree visitors.
Variants§
ScriptPubkey(AddrKeyhash)
ScriptAll(Vec<NativeScript>)
ScriptAny(Vec<NativeScript>)
ScriptNOfK(i64, Vec<NativeScript>)
The ledger CDDL types this threshold signed (int32 in Shelley,
widened to int64 in Allegra), not uint; do not narrow it back.
InvalidBefore(u64)
InvalidHereafter(u64)
Trait Implementations§
Source§impl Clone for NativeScript
impl Clone for NativeScript
Source§impl Debug for NativeScript
impl Debug for NativeScript
Source§impl<'b, C> Decode<'b, C> for NativeScript
impl<'b, C> Decode<'b, C> for NativeScript
Source§impl<'de> Deserialize<'de> for NativeScript
impl<'de> Deserialize<'de> for NativeScript
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Drop for NativeScript
impl Drop for NativeScript
Source§impl<C> Encode<C> for NativeScript
impl<C> Encode<C> for NativeScript
impl Eq for NativeScript
Source§impl PartialEq for NativeScript
impl PartialEq for NativeScript
Source§impl Serialize for NativeScript
impl Serialize for NativeScript
Source§impl ToCanonicalJson for NativeScript
impl ToCanonicalJson for NativeScript
Source§fn to_json(&self) -> Value
fn to_json(&self) -> Value
Building the tree is stack-safe, but the returned serde_json::Value
is not: serializing, cloning, comparing and dropping it recurse per
nesting level, and a chain-deep script overflows a 2 MiB stack doing
so. Use to_json_string when the
depth is not under your control.
Source§fn to_json_string(&self) -> String
fn to_json_string(&self) -> String
Writes the JSON text directly, never building a serde_json::Value,
so no step of rendering a chain-deep script can overflow the stack.