diff --git a/src/clarity/tuple.rs b/src/clarity/tuple.rs index 32af105..985b733 100644 --- a/src/clarity/tuple.rs +++ b/src/clarity/tuple.rs @@ -48,6 +48,13 @@ impl TupleCV { pub fn iter_mut(&mut self) -> std::slice::IterMut { self.0.iter_mut() } + + /// Gets a value from the underlying vector from a `TupleCV` instance. + pub fn get(&self, key: &str) -> Option<&ClarityValue> { + self.0 + .iter() + .find_map(|(k, v)| if k == key { Some(v) } else { None }) + } } impl IntoIterator for TupleCV {