Struct miniscript::expression::Tree
source · pub struct Tree<'a> {
pub name: &'a str,
pub args: Vec<Tree<'a>>,
}
Expand description
A token of the form x(...)
or x
Fields§
§name: &'a str
The name x
args: Vec<Tree<'a>>
The comma-separated contents of the (...)
, if any
Implementations§
source§impl<'a> Tree<'a>
impl<'a> Tree<'a>
sourcepub fn from_slice(sl: &'a str) -> Result<(Tree<'a>, &'a str), Error>
pub fn from_slice(sl: &'a str) -> Result<(Tree<'a>, &'a str), Error>
Parse an expression with round brackets
sourcepub fn to_null_threshold<const MAX: usize>(
&self
) -> Result<Threshold<(), MAX>, ParseThresholdError>
pub fn to_null_threshold<const MAX: usize>( &self ) -> Result<Threshold<(), MAX>, ParseThresholdError>
Parses an expression tree as a threshold (a term with at least one child, the first of which is a positive integer k).
This sanity-checks that the threshold is well-formed (begins with a valid
threshold value, etc.) but does not parse the children of the threshold.
Instead it returns a threshold holding the empty type ()
, which is
constructed without any allocations, and expects the caller to convert
this to the “real” threshold type by calling Threshold::translate
.
(An alternate API which does the conversion inline turned out to be too messy; it needs to take a closure, have multiple generic parameters, and be able to return multiple error types.)